mardi 24 mars 2015

Display custom widget, added as a shortcode in the correct place


I've created a custom Widget and I would like to add it to the page content as a shortcode.



function show_custom_widget() {
the_widget( 'WP_Custom_Plugin');
}
add_shortcode('custom-widget', 'show_custom_widget');


and I am using my shortcode in the post content as follows



[custom-widget]


As a result I get my Widget but it always displays at the top of the post content not in the place where I used the shortcode. How to make my widget display in the correct place ?





Aucun commentaire:

Enregistrer un commentaire