WordPress.org

Ready to get started?Download WordPress

Forums

Shortcodes on pages (1 post)

  1. teeli
    Member
    Posted 2 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags