• I’m just putting a site together and have run into a snag. https://giftgoggling.com/

    I’ve added the following code to my child index.php in order to keep the posts from that category showing up on my homepage.

    <?php
    if ( is_home() ) {
    	query_posts( 'cat=-66' );
    }
    ?>

    The code does exactly what I want it to, however I’ve noticed that when I click on the older and newer posts nav links at the bottom, I don’t scroll to the corresponding pages, I simply see the same ten posts again. And I’m guessing that’s because some posts from category 66 would be there.

    Could someone show me how to change the above code so that I omit that category AND have page nav that works properly?

    Thanks!

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

    <?php
    if ( is_home() ) {
    	query_posts( $query_string . 'cat=-66' );
    }
    ?>
    Thread Starter ElleJG

    (@ellejg)

    Thank you! We’re getting to where I want to go.

    However, when I navigate back to older posts, posts from cat 66 are there. Is there any way at all to exclude those posts from the older pages of the index and not just the front page?

    Just use:

    <?php query_posts( $query_string . 'cat=-66' );?>

    Thread Starter ElleJG

    (@ellejg)

    Hmm. Tried that but cat 66 posts still showing up when I scroll back a page to older posts.

    Any other ideas? I did check the codex here: https://codex.www.ads-software.com/Function_Reference/query_posts but that’s a bit over my head, I’m afraid.

    I appreciate your time.

    Site url?

    Thread Starter ElleJG

    (@ellejg)

    In the first post.

    Are there any other custom queries in index.php or an associated template file?

    Thread Starter ElleJG

    (@ellejg)

    Here is my index.php
    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    No template changes added to my child theme.

    Thread Starter ElleJG

    (@ellejg)

    I think i probably misunderstood when you said templates – I was thinking new page templates – but I have gone through all the .php files that I’ve added to my child and there are no more custom queries.

    Thread Starter ElleJG

    (@ellejg)

    Oops. Okay, no need to post index.php again. The only change I made was the exclude category custom query, and as mentioned above, I’ve gone through every mod i’ve made, and this is the only custom query.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Index Nav Corrupted’ is closed to new replies.