Execute shortcodes in PHP


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.

WordPressGeek 2 years 2020-12-31T09:10:33-05:00 0 Answers 3 views 0

Leave an answer