• Resolved Amy

    (@ontherye)


    I would like to add a slider to the homepage, underneath the logo/header. I have the slider code [metaslider id=1] but not sure where to put it exactly. Thanks for your help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author Ben Sibley

    (@bensibley)

    For this you’ll want to copy the “header.php” file from Apex into your Apex Child theme. Then, your site will load the header.php file in your child theme instead.

    Next, add the following after the closing header tag on line 44 of header.php:

    do_shortcode( '[metaslider id=1]' );

    That’s how you can output shortcodes within PHP files with WordPress. The last step is to style the slider which will depend on your preference.

    I should also mention that Apex Pro has a Featured Sliders option. It doesn’t place the slider below the header, but you can use it to replace any Post/Page featured image with a slider (and it uses Meta Slider).

    Thread Starter Amy

    (@ontherye)

    Ben, I tried to paste the code exactly as you said but it didn’t work. My site just goes blank. I tried to Google the code and below is what I found. I’m not sure if it’ll work with this theme:

    <?php if ( is_home() ):?>
    <?php echo do_shortcode(“[metaslider id=1]”); ?>
    <?php endif; ?>

    Thanks ??

    Thread Starter Amy

    (@ontherye)

    I’m terrible at this coding thing. Anyways, I found a tab in the slider plugin with the code so I just inserted it after line 44 like you said and it worked!

    <?php
    echo do_shortcode(“[metaslider id=22832]”);
    ?>

    Thanks again Ben. You’re the best!! =)

    Theme Author Ben Sibley

    (@bensibley)

    Awesome! I forgot they include the snippet like that.

    Glad it’s working now ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add Slider to Homepage’ is closed to new replies.