admin管理员组文章数量:1312690
I have a geolocation shortcode which i am adding in the post editor to display different information based on user's location, works perfectly by having it in the post page content.
How can i execute this shortcode [geolocation][/geolocation] inside a PHP file of my theme? i am using a free to modify Wordpress theme and i want to add a new <span>[geolocation][/geolocation]Information text content</span>
but inside the theme's .php file, how can i do that? if i add straight the <span>[geolocation][/geolocation]Information text content</span>
it will show the shortcode as text, it won't execute, please help, thanks in advance.
I have a geolocation shortcode which i am adding in the post editor to display different information based on user's location, works perfectly by having it in the post page content.
How can i execute this shortcode [geolocation][/geolocation] inside a PHP file of my theme? i am using a free to modify Wordpress theme and i want to add a new <span>[geolocation][/geolocation]Information text content</span>
but inside the theme's .php file, how can i do that? if i add straight the <span>[geolocation][/geolocation]Information text content</span>
it will show the shortcode as text, it won't execute, please help, thanks in advance.
2 Answers
Reset to default 1Found it: <?php echo do_shortcode( '[your shortcode goes here]' ); ?>
You can Execute the shortcode in php like the following
echo do_shortcode("[geolocation]");
本文标签: Execute shortcodes in PHP
版权声明:本文标题:Execute shortcodes in PHP 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741874970a2402408.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论