WordPress.org

Support

Support » Plugins and Hacks » Hacks » Shortcodes on pages

Shortcodes on pages

  • Hi,

    I’m developing a plugin for wordpress and I’m trying to use shortcodes to add content to posts and pages. I added a shortcode handler for it like this:

    function foobar_shortcode($attr) {
    ob_start();
    include($pluginpath . ‘foobar.php’);
    $ret = ob_get_contents();
    ob_end_clean();
    return $ret;
    }
    add_action(‘foobar’, ‘foobar_shortcode’);

    Now [foobar] works on posts, but not on pages. So how can I get shortcodes to work also on pages?

  • The topic ‘Shortcodes on pages’ is closed to new replies.
Skip to toolbar