Cyber Monday Sale!

Save up to $50 through December 5th.

Shop Now

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

Home Forums Support [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

    #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

    #379752
    Michael Mancini

    Hi Lyle,

    I just tried it and it didn’t work.

    Michael

    #379757
    Lyle

    Did you tick the Execute PHP box?

    #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?

    #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

    You’re welcome 🙂

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