• WP SITES

    (@wordpresssites)


    Haven’t looked in the code but i know its better to use a function rather than short code to load the slider.

    So this isn’t great:

    <?php
        if (is_home() || is_front_page()) {
            echo do_shortcode("[metaslider id=123]"); // replace 123 with your slideshow ID
        }
    ?>

    This is best

    <?php
        if (is_home() || is_front_page()) {
            sliders_function_name();
        }
    ?>

    Whats the name of the function for your slider?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Brad,

    I’m not sure why calling a function directly would be any better as the same code will run, its just a different way of calling it. The shortcode is the only entry point into Meta Slider.

    If you wanted you could add a function to your functions.php file:

    function show_metaslider($id) {
        echo do_shortcode("[metaslider id={$id}]");
    }

    Then use:

    show_metaslider(123);

    But I’m not sure what the advantage would be.

    Regards,
    Tom

    Thread Starter WP SITES

    (@wordpresssites)

    No worries Tom.

    Just thought i would mention it based on don’t do_shortcode by Konstantin Koveshenin

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Any Template Tag?’ is closed to new replies.