Try adding the following above the first if statement to see what actual day is being useddisplayed:
echo get_the_date();
It might also help to add the following lines to help debug exactly what the query is doing:
global $wp_query;
var_dump($wp_query);
The code is correct – so it has to be something else affecting the display. Does it do this for every month or just specific ones?
Related Posts:
- How do I remove unwanted pages like archive, search, etc.?
- How can I lock down an old wordpress install I don’t intend to update?
- WordPress Posts By Date/Day?
- How can I get the Month Name from Archive?
- What is archive.php used for?
- Archive widget – limit number of months to 12
- How do I visit archive-post.php?
- How do I make wp_get_archives show me months where only pages were created?
- Sort custom-posts in archive.php via meta-key?
- Including post_type = ‘wiki’ in author archives
- Output yearly archive within a page
- Create a month by month archive of pages (not posts)
- How to show specific year archive into dropdown list
- How to get the date dynamically from archive.php to date.php?
- How to make a custom Archive Page
- display archive as collapsing links
- how do I get the date in a date archive page
- Arrange and separate posts
- Customize first page of category
- Archive pages for posts based on their taxonomy?
- front end publishing not working on front-end page
- How to show static placeholder when less post elements in archive page?
- Show only post titles in archives?
- Preview Post/Custom Post types in Archive
- if there is only one post in the category, directly open
- How to hide a post from archives
- How to disable monthly archive
- When i try to open archive pages i get a 404 error
- How to Create Custom Archive page
- Does only custom post type have post type archive pages?
- Modify text after post count
- How to show year/month archive including months with no posts
- Displaying Archives List
- Custom archives function
- Page is displaying blog archives
- terms_description and admin problem
- wp_get_archives() display months even if there is no posts
- how do I encode links to specific archive searches?
- Some archive by year page return 404
- If one taxonomy contains the same term as another then display post
- How to filter by date & a specific custom post type post-WP 4.4?
- Author archive doesn’t work [closed]
- Having a problem with Next and Previous Links
- How to conditionally check for author archive when is_author() fails to work because the author has no posts
- Is there a better way to do headings for (all) archives?
- Date Archive pages 404 error
- Checking if a specific date archive is being displayed
- Filter post by clickable year [duplicate]
- Wrap the “show_post_count” between div
- Is a list page usually called an archive page in WordPress?
- I want my yearly archives to show a list of all posts
- remove 2014 from wp_get_archives
- How can I make a page for post formats (specifically quotes) in wordpress 3.5
- Create an archive listing based on meta array
- Can’t Access Sessions or Variables through pages
- How to make an archive page template using WordPress 3
- How to display an archive with multiple authors
- How to Get The Excerpt of the page that displays Blog Posts
- Where is the content that is outputted by get_the_archive_description()?
- Create simple columned archive page
- I created a normal page, but the page displays as an archive page
- Secondary WP_Query being overriden in archive page
- How to get the Custom Post Type Archive inside a folder
- Is there a way to multiply archive loop results sequentially?
- Blog pages show at most unrecognized by code
- Combining custom taxonomy posts with default posts on one archive page
- Create a custom URL for blog archive
- Custom loop in addition to default on archive page
- Show Daily Archives after specific dates
- Custom archive pages without “the loop”
- Remove posts from two categories in Archive Page
- How to get type of archive whether it is post or date or category archive?
- How can I create a master archive?
- Difference between $numpages & $max_page on archive pages
- Link back to (paged) archive and find the correct page
- Custom post archive page not opening 404 page
- How to disable date archives?
- Archive page no content to display
- Simplest way to archive a WordPress (and take down)?
- I want to be able to access archives to see how recently a post has been read: How can I do that?
- google index an Post type page I do not want
- How to Completely Remove Archive Title a.k.a the_archive_title?
- How to remove or hide archive page?
- How can I modify wp_get_archives() to not use archive.php template?
- Archives widget doesn’t work?
- Display future posts in archive
- Yearly Archive Page?
- date.php shows only three posts’ title. how to fix it?
- How to edit wordpress post without republishing
- Archive by Year
- Exclude a specific category link from archive / front page
- Is each issue of a magazine site a static page
- Create archives by author role
- How can i display in themplate file only a few post
- A problem with date archives
- how to hide all posts under one category
- Filter the post listing for a particular category from archive month list
- Show monthly or daily archives
- WordPress 3.6 – archive.php doesn’t get triggered [closed]
- How to have infinite scroll consider passed parameters?