[Support request] Elements Header not showing on tag archive

Home Forums Support [Support request] Elements Header not showing on tag archive

Home Forums Support Elements Header not showing on tag archive

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #2009859
    Carlos

    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!

    #2010765
    David
    Staff
    Customer Support

    Hi there,

    When i inspect the page i am not seeing a specific archive template being displayed in the body classes:

    2021-11-19_11-38-21

    it just says -template-default – which makes me think that there isn’t a specific template being used for the GP Elements display rules to match to.

    How is that archive page created ?

    #2011270
    Carlos

    Hi 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:

    screenshot
    screenshot

    Thanks!

    #2011283
    David
    Staff
    Customer Support

    You 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 and 296 us the ID of the page.

    #2011308
    Carlos

    Hi 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 );

    #2012040
    David
    Staff
    Customer Support

    To 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’?

    #2012399
    Carlos

    Hi David, yes it is showing up on all the website including the those archives

    ss

    #2012427
    David
    Staff
    Customer Support

    I 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 this is_page()

    #2012450
    Carlos

    I 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 );

    #2013015
    David
    Staff
    Customer Support

    Odd – can’t see why it wouldn’t work unless the ID is incorrect – is there anyway to check the Page ID its generating ?

    #2013026
    Carlos

    Yes 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:

    #2013897
    Elvin
    Staff
    Customer Support

    This 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');
    #2014201
    Carlos

    Hi Elvin, I removed the filters and it’s still not showing up.

    #2014445
    David
    Staff
    Customer Support

    Could you ask the plugin developer what Template Tags we can use to identify their archive/pages ?

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.