[Resolved] Using different content in hooks om homepage

Home Forums Support [Resolved] Using different content in hooks om homepage

Home Forums Support Using different content in hooks om homepage

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #261879
    Johan

    Hi support

    I want to display different things on my homepage and the rest of the site using the GPHooks. I tri this code but it won’t work:

    <?php if ( is_front_page() ) : ?>
    [fl_builder_insert_layout slug=”dkjob-2″]

    <?php else; ?>
    [fl_builder_insert_layout slug=”dkjob-2″]
    [fl_builder_insert_layout slug=”ritzau”]
    [ssbp]
    <?php endif; ?>

    #261893
    Tom
    Lead Developer
    Lead Developer

    Try this:

    <?php if ( is_front_page() ) { ?>
        [fl_builder_insert_layout slug="dkjob-2"]
    <?php } else { ?>
        [fl_builder_insert_layout slug="dkjob-2"]
        [fl_builder_insert_layout slug="ritzau"]
        [ssbp]
    <?php } ?>

    Make sure “Execute PHP” is checked.

    #261988
    Johan

    Thanks for quick reply!

    Works on the front page – but the rest of the pages are breaking …

    Is the code correct? Sorry, I’m not a PHP’er.

    #262044
    Tom
    Lead Developer
    Lead Developer

    There were curly quotes left over from WordPress formatting. Just adjusted the code above, give it another shot πŸ™‚

    #262365
    Johan

    Nope, it still breaks the pages πŸ™

    #262470
    Tom
    Lead Developer
    Lead Developer

    What do you mean by “breaks”? What about the pages are broken?

    #263122
    Johan

    This is how it should look: https://snag.gy/d79pGq.jpg

    This is how it looks after inserting the code: https://snag.gy/C5alRq.jpg

    #263191
    Tom
    Lead Developer
    Lead Developer

    Looks like there’s broken markup inside one of those shortcodes. Take a look in each one – each opening element (<div>, <p>, <span> etc..) should have a closing element (</div>, </p>, </span>).

    #263509
    Johan

    No, even if I removed all the shortcodes the problem persisted.

    But this worked (I know one of the shortcodes has changed but that is irrellevant):

    <?php if ( is_front_page() ) {
    echo do_shortcode( ‘ [fl_builder_insert_layout slug=”dkjob-2″] ‘ );
    }
    else
    {
    echo do_shortcode( ‘ [fl_builder_insert_layout slug=”dkjob-2″] ‘ );
    echo do_shortcode( ‘ [fl_builder_insert_layout slug=”ritzau-3″ type=”fl-builder-template”] ‘ );
    echo do_shortcode( ‘ [ssba] ‘ );
    }
    ?>

    #263584
    Tom
    Lead Developer
    Lead Developer

    Ah, maybe since it’s in a conditional it needs the do_shortcode function wrapped around.

    Glad you got it working πŸ™‚

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