WordPress.org

Ready to get started?Download WordPress

Forums

Older Posts not working. (6 posts)

  1. mcdonagh.matthew
    Member
    Posted 3 years ago #

    Hey All-

    My site is:
    http://www.derangeddiaries.com

    My "Older Posts" button at the bottom doesn't work, it loads this page:
    http://www.derangeddiaries.com/page/2/

    but the content is still the same as page one. I've gone through all of the forums and found similar problems, and I've applied the solutions offered already.

    In my case, I have certain categories excluded from the main page loop... and I found someone else who did that and had the same problem. Otto suggested he add this to his query_posts:
    $query_string.
    It worked for the person he helped, but did nothing for me.

    I really appreciate your help with this!

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Try:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'cat' => -12,-34,-56,
    	'paged' => $paged
    );
    query_posts($args);
    ?>
  3. mcdonagh.matthew
    Member
    Posted 3 years ago #

    Esmi-

    That worked beautifully! The older posts functionality works. One small issue, the second category exclusion (category 1660 in my case), is no longer working. It's curious because the first exclusion is. Here is the code I have in place:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    'cat' => -675, -1660,
    'paged' => $paged
    );
    query_posts($args);
    ?>

  4. mcdonagh.matthew
    Member
    Posted 3 years ago #

    Update:

    The second category (1660, Production) is still not being excluded succesfully.

    In addition, my search feature is no longer working. I made 2 changes since it last worked, the above edit and the installation of a plugin (Subscribe2). I deactivated Subscribe2 and the problem remained, so I am confident it has something to do with the above edit.

    As a reminder my URL is:
    http://www.derangeddiaries.com

    Thanks in advance for helping me out!

  5. mcdonagh.matthew
    Member
    Posted 3 years ago #

    Again, the search function is not working on the site since I made the above modifications. Any ideas on how to have my cake and eat it too (keep the older posts work, and fix the now broken search function).

    Thanks in advance, this whole community rocks!

  6. alchymyth
    Forum Moderator
    Posted 3 years ago #

    try and use
    'category__not_in' => array(675, 1660),
    instead of
    'cat' => -675, -1660,

    this should exclude the second category as well; however, this will not help with the search error.

    to have the search working, you:
    either have go back to try Otto's fix with using $query_string;
    or make a copy of index.php and save it as search.php - without the extra code.

    ---
    assuming that you want to exclude the categories as well for search results:
    the fix with $query_string:
    - remove the other code;
    - add this instead:
    <?php global $query_string; query_posts( $query_string . '&cat=-675,-1660'); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic