Using a shortcode in a WordPress theme

Posted by Gav on 13 October 2011 | 0 Comments

Tags: ,

Currently working on a WordPress project and I needed to include a WordPress shortcode into the theme files. This is to include a gallery as the background on all the pages.

This is how you add a WordPress shortcode into the theme.

Open up the themes php file. The file i used on my project is page.php

Use the do_shortcode function as below:

<?php echo do_shortcode('[shortcode option="value"]'); ?>

The code which I used to display the gallery on every page is:

<?php echo do_shortcode('[portfolio_slideshow id=27]'); ?>

Checkout the codex page


Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments