Archived topic
Category Hero Page- Remove Existing Category Layout Underneath it
11 replies · Started by Mike on December 12, 2021
Hi,
I set up an element with a page hero to replace an existing category. I click on "disable title" (see screenshot) but the category title and existing layout still shows underneath my page hero that I created (see screenshot).
Is there anyway to remove this?
Hi Mike,
I've checked the site and in question and the title you're trying to move is added by Elementor.
The "disable title" option will only work on titles generated by the theme.
If you wish to remove it, you'll have to remove it through Elementor. Try checking on Elementor's template library if it has something for Archive pages. :)
Thanks!!
I still see the "standard category" page underneath though (screenshot) is there anyway to remove this?
Hi there,
to remove the default archive loop you can use this PHP Snippet:
add_filter( 'generate_do_template_part', function( $do ) {
if ( is_category( '54' ) ) {
return false;
}
return $do;
} );
Change the 54 to the ID of the Category.
OK, do I need a plugin to do this? Or is there any way to add this code to a page without a plugin?
oops was meant to add the link to this doc which explains how to add PHP:
Is it possible to add this just for 2 category pages rather than the whole site?
I'd just like it for this category https://stronghomegym.com/gym-equipment/
and this one https://stronghomegym.com/guides/
Would you be able to help? I'm a bit worried about messing up the site
First go to Dashboard > Posts > Categories and Edit those categories. Check in the Browser URL Field and get the IDs eg. ID=4
Now the snippet will look like this:
add_filter( 'generate_do_template_part', function( $do ) {
if ( is_category( array( 66, 99 ) ) ) {
return false;
}
return $do;
} );
Change the 66 and 99 for your category IDs
Thanks David,
Maybe I'm a bit slow here, but I can't see any "Browser URL Field" or IDs
Hi Mike,
It's on your browser's URL as shown in this example here -
https://share.getcloudapp.com/mXuPkY40
Sorry I’m feeling very silly but I don’t see it…
https://stronghomegym.com/gym-equipment/
https://stronghomegym.com/guides/
Here's a step by step:
1.) Go to Admin > Posts > Categories
2.) Click "Edit" on the Category you want to get the ID of.
3.) Once you're on the "Edit category" page, check your browser's address bar.
Note: The address bar is where you type in the website you visit.
4.) You should see something like this - Example: https://share.getcloudapp.com/qGuR9Onp - on the URL, the ID is indicated.
That's the value you have to indicate on the PHP snippet's condition.
You can repeat the process for each category you need to get the ID.