$count = 1;
is set in the while loop, so every time the loop runs it sets to 1 again. Place it before your loop and it will work.
$count = 1; if (have_posts()) : while (have_posts()) : the_post();
Ow and the $count++ is outside the loop so it will only run after all the posts.
Change that to:
<?php $count++; endwhile; endif; ?>
Related Posts:
- WordPress loop specific thumbnail size
- Dynamic Stylesheet loads but doesn’t finish
- How to add condition in wordpress loop? [closed]
- Dividing the loop to style post differently
- Displaying post per day
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- How to add active class to custom menu using while loop and wp_list_pages
- Print html when custom field has value inside while loop
- Want to create Child theme, but already edited Parent theme css files and some php files
- When would you use $_post instead of $post?
- How do I display the function the_content in this loop?
- How to get to a specific position in wp_query?
- Facebook “like” open graph meta in header.php
- Put CSS inside a PHP file and include it the right way
- Missing sidebar parameter “fix” – before_content
- Using foreach loop breaks
- How to use my style.css file outside of wordpress subdomain?
- Loop with slider (slider not loading)
- How to hide all child pages with post_query?
- How to sort posts based on the value (number) of a post’s metadata?
- Can I install/embed WordPress on a ‘single page’?
- Displaying Woocommerce Product Category in WordPress
- How can I add extra word in permalink when someone click download button?
- Woocommerce : Can’t get product info in loop
- Checkbox doesn’t stay checked, conten
- proper way to add css using functions.php?
- Can we count the WordPress Loop
- RTL Stylesheet Confusion with WordPress
- Display an image if odd number of posts in grid
- How to make container class in PHP
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- PHP in CSS file?
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- Creating a blog on my companies new website using WordPress but I have sidebar issues
- Show recent posts starting at a specific number archive
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- Get ACF options field in PHP acting as CSS
- use loop to return blog details
- WP Query Leads to 502 Bad Gateway (Timeout Because Query Takes Too Long)
- How to add post meta in while loop?
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Calling function in loop causes repeat data
- Link to page with posts of specific type
- WordPress call post-ID in jquery
- How to Generate a list of Most Commented post?
- How to pick “full/thumbnail” images in the loop?
- Conditionally load class in the comment section of the post page
- How to Fix an Archive.php That Displays All Posts?
- How to add ASCII symbol after each recent post [closed]
- Search.php gets metadata from first post
- the_post(); prints out style text into my HTML?
- Using theme options to change a border-radius value
- Displaying images outside the content
- Applying css in functions.php
- PHP function for horizontal Woocommerce thumbnails and badges
- My top header looks different on single pages but is fine on the home page
- Using php code inside style tag
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- update_user_meta as multiple value but with same meta key
- Drop down question
- How to print all the inline styles in the WP_Styles instance together with their keys?
- The style.php file inside theme-engine folder has other content on FTP
- Site title not showing. Please help me
- Accordion headings cuts off to second line on collapsing a accordion heading (used acf repeater)
- WordPress Recent Posts – Loop
- ACF background-color per post in a WordPress loop
- Hot to edit WooCOmmerce dashboard?
- Advertisement in Loop Posts wordpress
- Using Sprit-sheet on WordPress categories
- Target a specific container to style on WordPress storefront theme
- How to include different html tags in the header for different pages?
- Adding custom PHP to existing loop in Genesis
- How to Pass Current Taxonomy Terms into new WP_Query?
- Font-Family does not looks like how it should be [closed]
- For each 3 posts, show a different post type
- Custom Theme, Editor won’t wrap text (i.e. change width)
- Click to expand menu
- Loop returns more items than exist?
- Modify category archive page loop on functions.php
- WP_Post is not from correct array
- Post formating on Home page
- divide custom field values in div every two values
- Limit ads appearing more than three times
- WordPress – Image href for home menu nav not working
- Pagination on Custom Loop
- What is the best way to get the first few post from WordPress in different divs using a loop?
- WP_Nav Highlight Parent Issue
- Changing 2011 theme header image based on user dropdown
- Custom single.php files for different post formats
- How to change a specific character in a theme option value – replace a space with a plus sign
- Troubleshooting “loopback requests that take too long”
- How do I get Roboto Google Font to display normal font-style? [closed]
- Using PHP for background-image property [closed]
- Loop on a wordpress Page instead of content coming from the WP text editor
- New to wordpress. Need Help with templates [closed]
- Help with if/else loop [closed]
- Parse error: syntax error, unexpected ‘}’ in
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]
- I want to show image from custom field image on my custom page template
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress