Add a Shortcode with Parameters in the Pre-Loop or Post-loop Fields

From iThemes Codex
Jump to: navigation, search

If you want to add a shortcode for the entire page (or if you want to add the same shortcode to each post layout) (in this example, [pb_videoshowcase group="0"], to show a videoshowcase group), add the following code at the end of your functions.php file (but before the closing ?>, if any).


function get_preloop_videos() {

    return do_shortcode( "[pb_videoshowcase group='0']" );
add_shortcode('my-videos', 'get_preloop_videos');


You can then add the shortcode [my-videos] to the LoopBuddy layout editor. Note that the name of the shortcode can be anything you want, as long as it matches the code in your functions.php.

← Back to LoopBuddy Codex Home