• Resolved OM2

    (@om2)


    I’ve got a plugin that I’ve written that acts on a short code
    The plugin expects a page ID as the argument and is something like this:
    [myplugin post=1]
    This work OK on its own

    But, how do I make sure this plugin is processed if I do other processing?

    For example, I’m playing around with creating a template that reads in page ID’s
    After reading in the page ID’s, I want to construct strings like [myplugin post=1]

    So, when the page or post is shown, then the shortcode for [myplugin post=1] should be triggered as it normally is

    Problem: I’m doing this and all I get printed is [myplugin post=1] ??

    How can I make sure that the plugin code is processed?

    Note: I want to keep the plugin code separate and independent – else I could just incorporate the plugin code

    Hope some of the above makes sense

    Thanks

    Omar

Viewing 7 replies - 1 through 7 (of 7 total)
  • vtxyzzy

    (@vtxyzzy)

    You probably need to apply_filters as shown here in the Codex.

    Thread Starter OM2

    (@om2)

    thanks for the reply
    i’m a little confused as to how to use whats given on that page?

    i’m not sure what to filter and what to pass it to?

    can u give any further guidance?
    let me know

    thanks

    vtxyzzy

    (@vtxyzzy)

    Well, I think I am the one confused. Can you explain a little more what you are doing with the template? I thought you were generating shortcodes in your template but they were not getting interpreted. What happens in the template with the generated shortcodes? Are they inserted into the content?

    MichaelH

    (@michaelh)

    As vtxyzzy not sure what you are attempting, but if you are trying to execute a shortcode in a template:

    <?php
    //formulate and execute a shortcode in a template
    // this could be used to get current page id  $page_num = get_query_var('page_id');
    $page_num = 7;
    $shortcode = '[myplugin post='.$page_num.']'
    echo do_shortcode($shortcode);
    ?>

    Thread Starter OM2

    (@om2)

    thanks for the replies
    let me try and explain…

    i have a shortcode function to which i supply a page or post id:

    [myplugin post=1]

    separately, in a page, i want to supply a page id and create the above as output:

    echo "[myplugin post=".$myPageID."]"

    what i want is WP to execute the sort code and not just output [myplugin post=1]

    am i making any sense?

    thanks

    MichaelH

    (@michaelh)

    Isn’t that pretty much what my example does?

    Thread Starter OM2

    (@om2)

    Isn’t that pretty much what my example does?

    erm: yes u r right – sorry, i didn’t read – only just re-read now
    works a treat!
    i did actually read about that function – but didn’t fully realise what i could use it for
    thanks a lot! ??
    i thought i’d be stuck on this one forever

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How can I make sure a plugin processes my code?’ is closed to new replies.