• Hey All-

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

    My “Older Posts” button at the bottom doesn’t work, it loads this page:
    https://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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'cat' => -12,-34,-56,
    	'paged' => $paged
    );
    query_posts($args);
    ?>
    Thread Starter mcdonagh.matthew

    (@mcdonaghmatthew)

    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);
    ?>

    Thread Starter mcdonagh.matthew

    (@mcdonaghmatthew)

    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:
    https://www.derangeddiaries.com

    Thanks in advance for helping me out!

    Thread Starter mcdonagh.matthew

    (@mcdonaghmatthew)

    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!

    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'); ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Older Posts not working.’ is closed to new replies.