[WordPress] How to call shortcode function directly and pass $atts

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by diabolo, Feb 22, 2011.

  1. diabolo

    diabolo Community Advocate Community Support

    Messages:
    1,682
    Likes Received:
    32
    Trophy Points:
    48
    I am using the Media Library Categories plugin. It does not have much documentation, so I have concluded the way to implement it would be using the shortcode [mediacategories categories="6"].

    I want to implement this directly into the theme template. So I have tried:
    PHP:
    <?php if(function_exists(do_shortcode('[mediacategories categories="6"]'))) { ?>
      <h1>Inspiration</h1>
    <?php
      do_shortcode
    ('[mediacategories categories="6"]');
    }
    I also tried to implement the function directly, but could not pass the $atts correctly for the function to use them.

    Same post on StackExchange.
     
    Last edited: Feb 22, 2011

Share This Page