I didnt find any plugin to have a shortcode usable in pages to display multiple loops as we need to show post of 2 diffrent catagorys in 2 places of a page ... i did come up with the following solution after searching around fr diffrent approches ... i think it might be usefull for ohter ppl and i'am intrested in feedback ... its geard for use in hybrid ...
useage:
[loop query="cat=1&showposts=2"]
Code:
function myLoop($atts, $content = null) {
extract(shortcode_atts(array(
"query" => '',
), $atts));
// de-funkify $query - taken from http://digwp.com/2010/01/custom-query-shortcode/ needed to get it working better ideas ?
$query = preg_replace('~�*([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $query);
$query = preg_replace('~�*([0-9]+);~e', 'chr(\\1)', $query);
global $wp_query;
query_posts( $query );
$more = 0;
ob_start();
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
<?php hybrid_before_entry(); // Before entry hook ?>
<div class="entry-content">
<?php the_content( sprintf( __('Continue reading %1$s', 'hybrid'), the_title( ' "', '"', false ) ) ); ?>
<?php wp_link_pages( array( 'before' => '<p class="pages">' . __('Pages:', 'hybrid'), 'after' => '</p>' ) ); ?>
</div><!-- .entry-content -->
<?php hybrid_after_entry(); // After entry hook ?>
</div><!-- .hentry -->
<?php endwhile; ?>
<?php else: ?>
<p class="no-data">
<?php _e('Sorry, no posts matched your criteria.', 'hybrid'); ?>
</p><!-- .no-data -->
<?php endif; ?>
<?php wp_reset_query();
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("loop", "myLoop");
?>