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

From IThemes Codex
Revision as of 15:34, July 22, 2013 by Elise (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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).

Code

function get_preloop_videos() {

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

Usage

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

Personal tools
Namespaces
Variants
Actions
iThemes Codex
Codex Navigation
Toolbox