- This topic has 5 replies, 3 voices, and was last updated 3 years, 5 months ago by
David.
-
AuthorPosts
-
November 18, 2022 at 2:48 am #2421101
Saini
Hi, I want a customization under post category archives and tag archives. Actually, I am using Ninjatable plugin which is fetching my wordpress website posts along with relevant details and showing in a table like row wise. I am using that table id in a particular category description lets say “exercise” category. when the category is opened first the table is opening showing the posts as per my conditions specified in the table(as per exercise and other categories). But at the bottom of the table the posts included in that category i.e. “exercise” are being fetched. What I want is that I have to show majority of the categories posts in tables only and dont want to show the archives associated with those category. Is there any possible way to hide or disable the archives of categories and tags. I know its tricky.. Please help.
Thank you
November 18, 2022 at 6:35 am #2421418David
StaffCustomer SupportHi there,
GP archive templates has the
generate_has_default_loopfilter.
And we can use it like so to remove the theme loop:add_filter( 'generate_has_default_loop', function($loop){ if ( is_category( 'your_category' ) ) { $loop = false; } return $loop; } );However this also removes the entry title where the description is displayed, so you will need to hook that back in:
add_action( 'wp', function() { add_action( 'generate_before_main_content', 'generate_archive_title' ); });The codes above are PHP – this doc explains how to add that to your site:
https://docs.generatepress.com/article/adding-php/November 18, 2022 at 11:08 am #2421979Saini
Thanks for replying david.
I have installed the generate_has_default_loop code through code sinppets plugin and its running fine i.e. ‘your_category’ changed to ‘exercise’ category, and now the exercise category page is not showing archive title, description or any archives.
However, when i tried to put this code
<?php
add_action( ‘wp’, function() {
add_action( ‘generate_before_main_content’, ‘generate_archive_title’ );
});
?>in Hook element and setting it to display on “exercise” category (Hook choosen: ‘generate_before_main_content’ and also “run on php” option ticked). It seems like the code is not working. No title, description is showing over that “exercise” category.
I dont know whether I am missing something. Please help
November 18, 2022 at 12:16 pm #2422086Ying
StaffCustomer SupportHi there,
Both David’s PHP code needs to be added via the code snippet plugin.
November 18, 2022 at 10:48 pm #2422489Saini
Amazing fix!
thanks David and Ying. You Guys r awesome..
Cheers.
0
November 19, 2022 at 6:00 am #2422802David
StaffCustomer SupportGlad we could be of help!
-
AuthorPosts
- You must be logged in to reply to this topic.