Execute shortcodes in post
-
I am trying to execute a action like a dynamic sidebar connected to a shortcode in a post. What I am try’ing the archieve is a dynamic sidebar or hardcoded something like a googlemaps or mailchimp signup widget in a shortcode function. I want the code to display in the middle of the post or any other place I call it.
I am experimenting with this code:
function test_function() {
return “<p>Here comes the output</p>”;
}
function register_shortcodes(){
add_shortcode(‘test’, ‘test_function’);
}
add_action( ‘init’, ‘register_shortcodes’);When I dont use return the shortcode always execute in the top of the post. When I use the return function I can execute it on the place were I want it but it wont accept PHP code. The problem I have is it is nessecary to use php code to call a dynamic sidebar for example in the function document so I can fill it with a plugin or smt.
Anyone can help me with a good article or tips?
- The topic ‘Execute shortcodes in post’ is closed to new replies.