• Okay, so my archive’s template works fine… unless you try to view the archives of July 2014 to the present. For example, you can go to https://readmk.com/2014/06/ and see the posts from that month. However, if you go to https://readmk.com/2014/07/ and any month past that to the present, it gives me the 404 error…. I have tried everything I know of to get them to work. The devotionals in this site are a custom post type, and are the only type of posts that the site uses the archives for. I am not new to wordpress, I know its ends and outs quite well, but this has completely baffled me as I’ve never seen this happen before. I’ve searched and searched, but cannot find a forum thread that helps me. Any help is greatly appreciated as my client is getting anxious. Thank you for your time!!

    I can post code if absolutely necessary, but the fact that it works for all dates prior to July 2014 makes it seem like its a bug that is deeper than my archive template.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Are there any differences (settings wise) between posts created on June 2014 and July 2014 ? different categories or custom post type ?

    When I browsed by year (https://readmk.com/2014/), no devotionals shows after June 2014, thus, it sounds like there’s no devotionals after June 2014.

    Hope that helps

    Thread Starter CalvinLeggett

    (@calvinleggett)

    There are surely posts after June 2014. I believe he makes a devotional post every day/week. And there are different categories for the devotionals, but there are devotional posts from the same category in July 2014 as in June 2014. Thanks for replying, but unfortunately your advice doesn’t help me much :/

    Thread Starter CalvinLeggett

    (@calvinleggett)

    Is there no solution to this problem? 🙁

    does the theme have a template archive.php? or date.php?
    https://codex.wordpress.org/Template_Hierarchy

    what is the exact code of these files?

    does the issue continue when you deactivate all plugins?

    Thread Starter CalvinLeggett

    (@calvinleggett)

    Yes, it has an archive.php template, but not a date.php template.

    Here is the query in my archive.php file:

    $monthnum = get_the_date('m') + 0;
    $year = get_the_date('Y');
    
    $args = array(
        'post_type' => 'devotional',
        'monthnum' => $monthnum,
        'year' => $year,
        'orderby' => 'date',
        'order' => 'desc',
        'paged' => get_query_var('paged'),
        'posts_per_page' => 10
    );

    The issue is persistent even when all plugins are disabled.

    what is the full code of archive.php?
    http://codex.wordpress.org/Forum_Welcome#Posting_Code

    caveat:
    using get_the_date() outside the loop might have random results.
    for testing, try and print the variables $monthnum and $year

    try to remove the custom query from archive.php –

    if you want to use only a specific post-type in the archive, work with ‘pre_get_posts’ – https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts

    Thread Starter CalvinLeggett

    (@calvinleggett)

    Sorry, the email telling me you replied got swept under the rug and I just saw it lol. Thank you for your reply! Here is a link to the full code: http://pastebin.com/kFgSv8cK

    I haven’t worked with pre_get_posts much, but I appreciate the tips! I will try to change it up and see what results I get.

    If you don’t mind, after looking at my code, alchymyth, how would you write it?

    Thanks again for your help!!!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Archives stop showing posts after specific month’ is closed to new replies.