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

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
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:
Top