- This topic has 13 replies, 3 voices, and was last updated 2 years, 4 months ago by David.
-
AuthorPosts
-
November 18, 2021 at 11:01 am #2009859Carlos
Hello, thanks for this amazing plugin. I’m having an issue displaying a custom elements header in the tags archive pages for the “Directories Pro” plugin https://codecanyon.net/item/directories-pro-for-wordpress/
I’ve tried displaying the header in the regular wordpress tags archives and it works. Can you help me figure out what the issue is?
Thanks in advance!November 19, 2021 at 4:48 am #2010765DavidStaffCustomer SupportNovember 19, 2021 at 8:57 am #2011270CarlosHi David, is automatically created by the Directories pro plugin, I don’t know more details about it, should I ask for some specifics about it to the developer?
Alternatively is there a way around to add a function so I can show the header using the id of the categories? as you can see in the body classes I get different id pages depending on the category that is being displayed:
Thanks!
November 19, 2021 at 9:08 am #2011283DavidStaffCustomer SupportYou could leave the Element display rules empty and then use the
generate_element_display
filter:https://docs.generatepress.com/article/generate_element_display/
For example:
add_filter( 'generate_element_display', function( $display, $element_id ) { if ( 12345 === $element_id && is_page( 296 ) ) { $display = true; } return $display; }, 10, 2 );
Where
12345
if the is the ID of the Block Element and296
us the ID of the page.November 19, 2021 at 9:38 am #2011308CarlosHi David, I added the function as instructed but still no header is showing up
add_filter( ‘generate_element_display’, function( $display, $element_id ) {
if ( 8551 === $element_id && is_page( ‘296’ ) ) {
$display = true;
}return $display;
}, 10, 2 );November 20, 2021 at 6:35 am #2012040DavidStaffCustomer SupportTo test – if you create a simple block element – just some text, and set it the
after_header
hook. And set the Display Rules to All Pages – does it display on those ‘archives’?November 20, 2021 at 10:18 am #2012399CarlosHi David, yes it is showing up on all the website including the those archives
November 20, 2021 at 10:49 am #2012427DavidStaffCustomer SupportI tweaked my snippet here:
https://generatepress.com/forums/topic/elements-header-not-showing-on-tag-archive/#post-2011283
the change being i removed the
''
commas from the ID in thisis_page()
November 20, 2021 at 11:15 am #2012450CarlosI changed it but still not showing up
add_filter( ‘generate_element_display’, function( $display, $element_id ) {
if ( 8551 === $element_id && is_page(296) ) {
$display = true;
}return $display;
}, 10, 2 );November 21, 2021 at 5:10 am #2013015DavidStaffCustomer SupportOdd – can’t see why it wouldn’t work unless the ID is incorrect – is there anyway to check the Page ID its generating ?
November 21, 2021 at 5:27 am #2013026CarlosYes it’s odd,
So here it’s the category:
This is the body class generated when accessing that category:
And this is the element ID:
November 21, 2021 at 6:47 pm #2013897ElvinStaffCustomer SupportThis may be a plugin conflict w/ GP and GPP.
To test, can you check if the header will display if you remove some filters?
Example filter/s:
add_filter('drts_wordpress_archive_force_singular', '__return_true'); add_filter('drts_wordpress_archive_force_is_page', '__return_true'); add_filter('drts_wordpress_archive_force_is_not_archive', '__return_true');
November 22, 2021 at 2:55 am #2014201CarlosHi Elvin, I removed the filters and it’s still not showing up.
November 22, 2021 at 6:13 am #2014445DavidStaffCustomer SupportCould you ask the plugin developer what Template Tags we can use to identify their archive/pages ?
-
AuthorPosts
- You must be logged in to reply to this topic.