[Resolved] I need to put beaver builder shortcode in a hook for posts only

Home Forums Support I need to put beaver builder shortcode in a hook for posts only

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #379709
    Michael Mancini

    Hi,

    Is this possible? A beaver builder shortcode looks like this: [fl_builder_insert_layout slug=”my-post-slug”]

    How can I put this in a hook that only shows on posts?

    Thanks,
    Michael

    GeneratePress 1.4
    GP Premium 1.4.3
    #379744
    Lyle

    Michael –

    This should do it 🙂

    <?php if ( is_single() ) { ?>
    <?php echo do_shortcode( '[fl_builder_insert_layout slug=”my-post-slug”]' ); ?>
    <?php } ?>

    Cheers!
    Lyle

    http://snifflevalve.com
    Tutorials and tips for GeneratePress, WP Show Posts, WordPress and Elementor

    #379752
    Michael Mancini

    Hi Lyle,

    I just tried it and it didn’t work.

    Michael

    #379757
    Lyle

    Did you tick the Execute PHP box?

    http://snifflevalve.com
    Tutorials and tips for GeneratePress, WP Show Posts, WordPress and Elementor

    #379765
    Michael Mancini

    Yes.

    #379766
    Lyle

    That’s odd. I just tried it on a test site and it works fine 🙂 Which hook location are you using?

    http://snifflevalve.com
    Tutorials and tips for GeneratePress, WP Show Posts, WordPress and Elementor

    #379767
    Michael Mancini

    I tried Before Footer and After Content. Using this:

    <?php if ( is_single() ) { ?>
    <?php echo do_shortcode( ‘[fl_builder_insert_layout slug=”custom-grid-recent-posts”]’ ); ?>
    <?php } ?>

    #379785
    Michael Mancini

    I am getting this error on every page. Image

    #379814
    Tom
    Lead Developer
    Lead Developer

    This should be the code:

    <?php if ( is_single() ) {
        echo do_shortcode( '[fl_builder_insert_layout slug="custom-grid-recent-posts"]' );
    } ?>
    #379821
    Michael Mancini

    Hi Tom,

    That worked.

    Thanks,
    Michael

    #379824
    Tom
    Lead Developer
    Lead Developer
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.