Another solution would be to use an ordered list.
$my_query = new WP_Query($args);
if ( $my_query->have_posts() ) :
echo '<ol style="list-style:decimal">';
while( $my_query->have_posts() ) : $my_query->the_post();
echo '<li><a href="' . get_permalink( get_the_ID() ) . '">' . get_the_title() . '</a></li>';
endwhile;
echo '</ol>';
endif;
Related Posts:
- C++ – how to find the length of an integer
- How can I make a PHP counter?
- Counting the posts of a loop (WP_Query)?
- Category and children post count
- Hide the post count behind Post Views (Remove All, Published and Trashed) in Custom Post Type
- How to display 2 equal columns of li based on the count of items in wp_nav_menu divided by 2?
- How to cache a shortcode functions output?
- Show weekly posts statistic in WordPress
- Increasing post view count automatically [duplicate]
- Count number of posts by author in a category
- How we count the user draft posts
- server load. $_SERVER[‘REMOTE_ADDR’] and $_SERVER[‘HTTP_HOST’] [closed]
- Get count of terms with a post and another taxonomy term?
- Get Gravity Forms field values and count how many? [closed]
- Counting posts in custom post type by author
- Show ellipsis (…) only if the number of characters exceeds limit defined in substr
- How effective are cacheing plugins for dynamic pages?
- Get total views of all posts by author
- Count post + add number =
- How to do simple addition to increase favorites count of my wordpress posts
- Count posts published in one particular day: the lighter way
- Why does my site flash white every time it changes page? [closed]
- What is the best way to do this? [closed]
- Should I store critical css in the database or in my theme’s filesystem?
- Search Count WordPress Theme
- How to read out the excerpt length (for if-condition)
- What will be the best caching system for wordpress blog which has more than one million blog posts? [closed]
- $count_posts->draft & published
- CountPost WordPress Custom Taxonomy
- How to optimize ‘select found_rows()’ query? Several ‘high load average’ alerts daily
- get the count of table rows
- How to calculate posts number? [closed]
- How make animation increase of number
- Having problems getting the number of plays in a WordPress Playlist from an audio file
- How to show the amount of post that have on the site?
- Count how many files in directory PHP
- Configuring WordPress for Amazon CloudFront Caching?
- Does a low traffic WordPress site need a caching plugin and a CDN
- count posts from custom taxonomy terms by year
- What is the expected limit for acceptable performance of WordPress without any adjustments?
- WP script versioning breaks cross-site caching?
- WordPress transients for a shortcode
- Count number of post in Taxonomy?
- Taxonomy list. Order by a specific custom post type count
- Should the page cache be refreshed often? [closed]
- Plugin a specific cache functionality?
- Too many MySQL connections on WordPress
- Transient caching for wp query
- Register script version not showing
- How to count rows of table in the_content()
- How do I fetch feed info from cache instead of directly from feed?
- Does get_terms() use any sort of caching on its query?
- Comment Moderation and CDN Caching
- Plug-in Conflict: Art Direction and Super Cache
- Post count by month of taxonmy term
- custom post type category count shortcode
- WordPress & Fastcgi proper setup?
- Show posts count for Categories and Tags in wp_nav_menu
- Is it duplicated if I cache an object that uses data from postmeta?
- Combile External JS files using W3 Total Cache [closed]
- Images not showing in media grid view (but showing in list view)
- Get Author Count By Day, Week and Month
- W3 total – leverage browser caching not working with cdn delivered images [closed]
- counting trackbacks, pingbacks and comments of a post
- How much resources are good enough for 3.9.2
- How to Define Custom Number of Items in Comment Feed
- Order terms by count – missing terms
- Count user posts and store the number for later use
- Cache plugin for medium traffic news blog
- Scheduling doesn’t work due to caching?
- How to Automatically import external images to Upload
- How include comment and post count of user in this custom query
- W3 Total Cache plugin chronic message
- How to fix caching issue in PHP data from database
- get_queried_object not work in taxonomy page
- Unable leverage Browser Caching on AWS Bitnami stack (Apache) through W3TC and Cloudfront CDN
- How to find out programmatically whether any cache plugin is installed in the WordPress website?
- Modify the category post counting function
- Implementation to count page visits of unique visitors based on a cookie
- Add subcategories posts to the counts column at the admin’s categories list
- Timthumb isn’t displaying any images. “A TimThumb error has occured
- Can I do fragment caching with NGINX fastcgi?
- FATAL ERROR – white page – no site showing
- Should I Save widget HTML to a file cache?
- GravatarLocalCache Plugin Broken in WordPress 4.2
- How to add a post counter to the list of custom taxonomy terms?
- How to limit the number of posts a user can publish based on user type
- Would Amazon AWS Services be a good alternative to my current hosting provider?
- WordPress theme Modifications not showing up on live server
- File permissions for wp-minify plugin
- WP 3.5 caching problem
- How do I count the number of pages a user has seen on my site, and force them to log in after a certain amount
- Convert WordPress to static website by using the pages generated by the caching plugin?
- Keeping Objects in Memory
- Styling not refreshing for old visitors on WordPress
- Setting expires headers for static content served from nginx
- How can I improve and optimise my wordpress web server for better performance in 2023
- How do i display the number of images on the “post screen”
- How can I wordpress cache a database request with no existing plugin?
- Request initiator chain contains old CDN