Insert shortcode in template
-
Hello,
how do I insert a Collapse-O-Matic shortcode in a template?
Thanks in advance!
-
use do_shortcode
Thanks for your fast reply.
I already tried the following:
<?php echo do_shortcode('[expand title="Mehr Erfahren" swaptitle="Weniger" targclass="collapse-container" id="impressum" rel="star-highlander" findme="auto" trigclass="mehr-erfahren-trigger" tag="div"]Content[/expand]'); ?>But that does not work…
It looks like this on the Site:
Mehr Erfahren
Content-
This reply was modified 6 years, 10 months ago by
castorpollux285.
check the plugin settings and verify that ‘shortcode loads scripts’ is not checked.
It is not checked.
The code you posted above should work. can you share a link to the page you are testing this on?
https://krenn.design/collapse-o-matic/
It’s located at the bottom in the blue rectangle.
the shortcode is being processed correctly.
However, the javascript and css files are not being inserted in the header or footer. Does the shortcode work when placed as normal in a test post or page?Also, check the js console, you have three errors being thrown.
As it seems this is a custom built theme, please ensure that wp_head() is being used in the header.php file and wp_footer() is used in the footer.php file. Regardless, this is beyond the support of our plugin.
Adding wp_head() and wp_footer() fixed the problem.
Thank you very much!
-
This reply was modified 6 years, 10 months ago by
The topic ‘Insert shortcode in template’ is closed to new replies.