ttc_mn 0 Report post Posted April 16, 2011 In the functions.php file of platformbase added the following code: ` add_action('pagelines_before_brandnav','add_tedtimer'); function add_tedtimer () { echo do_shortcode ('[dtimer]'); } // [dtimer] is valid shortcode from a plugin that works fine in regular posts ` Result: The hook places only the text "[dtimer]" in the proper location before the brandnav (not the result of calling dtimer). Is it possible to use shortcodes with hooks? If so, what am I doing wrong? Thanks. Share this post Link to post Share on other sites
Simon 248 Report post Posted April 16, 2011 ` add_action('pagelines_header','my_example'); function my_example () { echo do_shortcode ('[show_hello]'); } function hello_function() { echo 'hello'; } add_shortcode('show_hello', 'hello_function' ); ` This works fine. Share this post Link to post Share on other sites
ttc_mn 0 Report post Posted April 16, 2011 Thanks Simon - your example works fine. You defined the function "hello_function ()" and added the shortcode for "hello_function" in the same php file. I want to 'call' a shortcode that already exists in a separate plugin file (in the 'plugins' directory) that contains numerous shortcodes. Does this make sense? Share this post Link to post Share on other sites
Simon 248 Report post Posted April 16, 2011 If the shortcode has previously been defined then it would not matter what file it is in. Share this post Link to post Share on other sites
ttc_mn 0 Report post Posted April 16, 2011 Ok.Thanks very much for your help. Share this post Link to post Share on other sites