Home › Forums › Support › Using different content in hooks om homepage This topic has 9 replies, 2 voices, and was last updated 7 years, 3 months ago by Tom. Viewing 10 posts - 1 through 10 (of 10 total) Author Posts January 8, 2017 at 9:33 am #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; ?> January 8, 2017 at 10:02 am #261893 TomLead 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. January 8, 2017 at 2:53 pm #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. January 8, 2017 at 10:57 pm #262044 TomLead Developer Lead Developer There were curly quotes left over from WordPress formatting. Just adjusted the code above, give it another shot π January 9, 2017 at 2:43 pm #262365 Johan Nope, it still breaks the pages π January 9, 2017 at 11:50 pm #262470 TomLead Developer Lead Developer What do you mean by “breaks”? What about the pages are broken? January 11, 2017 at 2:08 pm #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 January 11, 2017 at 8:06 pm #263191 TomLead 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>). January 12, 2017 at 1:13 pm #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] ‘ ); } ?> January 12, 2017 at 8:16 pm #263584 TomLead Developer Lead Developer Ah, maybe since it’s in a conditional it needs the do_shortcode function wrapped around. Glad you got it working π Author Posts Viewing 10 posts - 1 through 10 (of 10 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In