[Resolved] Nested Shortcode in Page Header.

Home Forums Support Nested Shortcode in Page Header.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #356741
    Emran

    My setup is EL+Pro+GP+GPP.

    I made 2 template in Elementor LIbrary. Then added those shortcode to slider content. When the slider template added directly to Page, it works. But when I added it IN Page Header (GPP 1.4 rc1), it only execute first level shortcode.

    How I able to solve that??

    Page Header -> [slider template] -> [slide 1 Template] & [slide 2 Template]

    In this format, slide 1 and slide 2 template are not working.

    Demo URL: http://50.28.105.70/~toassess/

    Here same slider template added as Page Header and below page header.

    Emranul Hassan

    GeneratePress 1.3.48
    GP Premium 1.3.1
    #356939
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    So if the slider shortcode is added into the page header, and the slider shortcode has an Elementor shortcode, the Elementor shortcode doesn’t execute?

    #356952
    Emran

    Thanks Tom for quick reply.

    Slider Shortcode executed properly. But In each slide, I added elementor shortcode as content, which do not execute.
    Here is the image for your reference.
    Individual Slide of Elementor SLider Element

    Here is Source Code, where shortcode placed in individual slide do not execute properly.
    Not executed Shortcode of Individual Slide

    If you require, I can give you wp-admin access.

    Emran.

    #357111
    Tom
    Lead Developer
    Lead Developer

    This might be an issue with the Elementor text field not executing shortcodes. Have you checked with their support?

    #357313
    Emran

    Thanks for your reply.

    I tested same slider shortcode in Elementor Shortcode Element and Text Editor Element. It works perfectly.

    But when I add same shortcode in Page Header and GP Hooks, it only execute first level Shortcode, nested shortcode do not executed.

    Any suggestion?

    Emranul Hassan

    #357370
    Tom
    Lead Developer
    Lead Developer

    I’m not really seeing how the Page Header is coming into play within the above scenario? I see an Elementor shortcode inside a Slides field inside Elementor. When does Page Header enter the picture?

    From a coding perspective, the content inside the Page Header is ran through the do_shortcode() WP function – that’s the core way of executing shortcodes.

    #357377
    Emran

    I wanted to make that Slider as Page Header in Homepage, so that I can do some customization on Navigation and to make Navigation over the Slider.

    It also not works in GP Hooks.

    I can do that in different way, adding elementor section below navigation then adding negative margin and navigation background as transparent. But then I am missing lots of customization you offer in Page Header for Navigation color/background etc.

    I think, I am unable to make the scenario clear to you. If wp-admin access helps you to understand better, I can provide you admin access.

    #357391
    Emran

    Actually I made it work adding a Filter Hook in your Page-Header.php and additional filter to do do_shortcode of Header COntent.

    Page-header.php

    So please inform us, what filter you use to output content of page header. It will solve my issue.

    Thanks.
    Emranul Hassan.

    #357607
    Tom
    Lead Developer
    Lead Developer

    What’s the iwebw_additional_shortcode filter?

    If you look lower to where the content is out, it’s wrapped in the do_shortcode() filter. According to WP, that’s all that needs to be done in order to execute shortcodes.

    #357618
    Emran

    iwebw_additional_shortcode I just experimenting some alternatives to solve my issue.

    Yes. I saw the code has do_shortcode filter wrapped in $options[‘content’].

    My situation is like [shortcode1] some content [shortcode2] some content [/shortcode1].

    Everytime, shortcode1 is executed, but shortcode2 is not executed.

    So I need to pass the content of shortcode1, one additional do_shortcode filter to execute shortcode2.

    Sp please could you please tell me how I can hook into page header content, specially $options[‘content’], so that I can add additional filter to get my desired output.

    #357880
    Tom
    Lead Developer
    Lead Developer

    What you’re trying to do isn’t something I imagined would be necessary at any point, so I’m not 100% sure it’s even possible.

    One possible solution:

    add_filter( 'generate_page_header_options', 'tu_alter_page_header_content' );
    function tu_alter_page_header_content( $options ) {
        $options['content'] = apply_filters( 'iwebw_additional_shortcode', $options['content'] );
        return $options;
    }
    #357896
    Emran

    Thanks for your support.

    1. I deleted the additional line of code I added in page-header.php.
    2. I added the following modified code as per your suggestion and it works fine

    add_filter( 'generate_page_header_options', 'tu_alter_page_header_content' );
    function tu_alter_page_header_content( $options ) {
        $options['content'] = do_shortcode( $options['content'] );
        return $options;
    }

    Thanks. Have a nice day.

    #357919
    Tom
    Lead Developer
    Lead Developer

    Very strange as the code does that for you anyways on output.

    Either way, glad it’s working for you now 🙂

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