Viewing 15 replies - 1 through 15 (of 16 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try it by removing this from archive.php:

    <?php wp_pagenavi();?>

    Thread Starter globalreporter

    (@globalreporter)

    Thanks. It worked, but it also removed page numbers from all my arhive pages. I just want to remove it from my category pages. Other suggestions?

    Moderator keesiemeijer

    (@keesiemeijer)

    Try this:

    <?php
    if(!is_category()){
    wp_pagenavi();
    }
    ?>

    Thread Starter globalreporter

    (@globalreporter)

    Perfect. And what should I add to this code if I want to hide the page numbers only form specific categories? Shall I add the category name or ID somewhere and in which form?

    Moderator keesiemeijer

    (@keesiemeijer)

    https://codex.www.ads-software.com/Conditional_Tags#A_Category_Page

    if(!is_category(array( 4,5,6 ))){ // id's
    wp_pagenavi();
    }

    Thread Starter globalreporter

    (@globalreporter)

    Amazing! Sorry if I abuse of your expertise, but since we are messaging I dare to ask you a last question. would like to know what I have to do to hide posts from specific category pages. I have some category pages where I want to have no posts at all, so that I can have a full content control through my widgets.

    Moderator keesiemeijer

    (@keesiemeijer)

    Same thing really:

    <?php
    if(!is_category(array( 4,5,6 ))) : ?>
    <!-- only loop through post if the current category is not one of these category id's 4,5,6 -->
    <!-- The Loop here -->
    <?php else : ?>
    <!-- do stuff for category id's 4,5,6 -->
    <?php endif; ?>

    To get the current category ID on a category template file you can use:

    $current_cat = get_query_var('cat');

    Thread Starter globalreporter

    (@globalreporter)

    Well, I pasted in the archive.php file your code where I only replaced the fake IDs with those of the categories where I want to have posts, but posts still show in all category pages

    <?php
    if(!is_category(array( 4,5,6 ))) : ?>
    <!– only loop through post if the current category is not one of these category id’s 4,5,6 –>
    <!– The Loop here –>
    <?php else : ?>
    <!– do stuff for category id’s 4,5,6 –>
    <?php endif; ?>

    Moderator keesiemeijer

    (@keesiemeijer)

    Where it says <!-- The Loop here --> you have to put the loop that is already in your archive.php template file

    If you still have problems implementing this paste and submit the full code of archive.php of your theme into a pastebin.com and post the link to it here? see the Forum Rules for posting code and using the pastebin.

    And give me the category ID’s where you dont want posts to show up.

    Thread Starter globalreporter

    (@globalreporter)

    Here you are the pastebin url:
    https://pastebin.com/wm4KnLMa

    I would like to have two versions of my archive file:
    1) only 1 post shown in categories 4, 5 and 7
    2) no post shown in categories 4, 5 and 7

    So then I can decide which of the I want to use

    Thanks fro your help

    Moderator keesiemeijer

    (@keesiemeijer)

    The Pastebin goes to: “Unknown Paste ID!”.

    Thread Starter globalreporter

    (@globalreporter)

    it’s because I set the expiration to one hour, now I set it to one days, so it should work. Here you are: https://pastebin.com/rDfL54fi

    Moderator keesiemeijer

    (@keesiemeijer)

    No posts shown: https://pastebin.com/3ir2kctZ

    For 1 post shown you need to alter the function itx_loop() in functions.php and leave the archive file as it was

    function itx_loop(): https://pastebin.com/g4LCSeNA

    Thread Starter globalreporter

    (@globalreporter)

    Thanks, but I still have problems:

    When I paste the loop code in archive.php to have zero post, also the category page title and all my widgets disappear: I’d like them to still be there!

    When I paste the loop code in functions.php to have 1 post, also the category page title disappear and the page navigation is back again: I’d like to have the former there and the latter not there!

    I think I am stuck…

    Thread Starter globalreporter

    (@globalreporter)

    Wandering if your read my last message, sorry for bothering

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Theme: Bombax] how to hide pagination in category pages’ is closed to new replies.