Support » Plugins » Plugin shortcode after post loads

  • Resolved LoganSix

    (@logansix)


    I am creating a new plugin that uses shortcode for two items. One for each individual item and then another to combine links to the individual items.

    i.e.
    [summary]
    [item id=”1″]
    [item id=”2″]
    [item id=”3″]
    [item id=”4″]

    If I add the [summary] tag at the start of the post, it doesn’t get the values from the items. If I add it after the items, it get each of the items afterward. However, I want the [summary] shortcode to appear at the top of the post and not at the bottom.

    Any ideas? I tried to add the function at “end_loop”, but that didn’t work.

Viewing 1 replies (of 1 total)
  • Thread Starter LoganSix

    (@logansix)

    Okay, I figured it out!!

    I created a function to add the shortcode after the content is called.

    function my_shortcode($content) {
    		   add_shortcode('myshortcode', array(&$this, 'myshortcodefunction'));
    		   return do_shortcode($content);
    		}

    Then I added the function as an action

    add_action('the_content', array(&$this, 'my_shortcode'), 11);

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin shortcode after post loads’ is closed to new replies.