Use the below example code to create short code always displaying at the top of the page
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function friendly_loop_shortcode( $atts, $content = null ) { extract( shortcode_atts( array( 'category' => '', 'module' => '' ), $atts ) ); ob_start(); include(locate_template('loop-'.$module.'.php')); $output = ob_get_clean(); //print $output; // debug return $output; } if (!is_admin()) { add_shortcode('test', 'friendly_loop_shortcode' ); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.