Public Ticket #3513860
Slider display on homepage only using shortcode?


  • jonathonfowler started the conversation

    Hi, I have added a slider to my homepage using the following code: [layerslider id="24" filters="homepage"] to ensure the slider only appears at the top of my homepage, however, the code [layerslider id="24" filters="homepage"]  appears at the top of many other pages on my website. 

    I am adding the code to my site using Genesis Simple Hooks, and adding the code to the "genesis_after_header" hook - this displays the slider immediately below my menu with zero gap.

    Unfortunately, the code is also appearing at the same location on multiple pages. 

    Question 1: Where should I place the shortcode on my site to get the same positioning of the slider right under my menu without any gap, at the top of my homepage only? Can this code be added without using Genesis SImple Hooks? I don;t understand where to place the shortcode.

    Question 2: Is there a PHP code I can use at the top of my front-page.php file to ensure the slider only loads on my homepage?

  •  70
    John replied

    Hi Jonathon,

    Thank you for getting in touch with us. My name is John, and I'm happy to assist you today. I appreciate your patience while we've been working toward your ticket.

    The shortcode you're using appears correct, and the slider should only display on your home page. I've done a quick test on our test servers. It's working fine for me, and we haven't received any complaints. Unfortunately, I don't have experience with the Genesis Simple Hooks plugin, but it shouldn't be necessary at all. 

    The place where you should enter the shortcode depends on the WordPress theme and page builder you're using. It's the responsibility of the WordPress themes to offer a way to embed content right after the menu. They usually achieve this with custom page options in the page editor or by providing custom Widget areas. 

    Alternatively, since you're also looking for a PHP code, you can edit the appropriate page template and add something like this:

    <?php layerslider(24, 'homepage'); ?>

    This also uses the "homepage" filter. However, since you're editing PHP, you can use any custom logic if needed.

    Best Regards,
    John | Kreatura Dev Team