I'm using a shortcode to pull in different loops via the loops-name.php. For some reason it is always at the top of the page. I googled it and using echo instead of return causes that problem but with my code I am not using echo. Here's the shortcode:
// setup the shortcode for use
function friendly_loop_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'category' => '',
'module' => ''
), $atts ) );
include(locate_template('loop-'.$module.'.php'));
}
Any idea why this is happening?
get_template_part('loop',$module)
instead, it's prettier, quicker to type, supports parent/child themes, and it's the recommended method of including templates in wordpress ( yes locate_template may do some of those things but look how much less readable it is!)