Wait a minute... This content is very very old. We no longer sell or support this theme version. New Topics
Version 9
Gavin Hammond
0 points
Beginner
I want to list 20 posts from a category called networks. I do not want to use the shortcode, as I need to use a new template style. So i want to create a function to list 20 posts in the category networks. What should be my post type, taxonomy, and terms?
I want to list 20 posts from a category called networks. I do not want to use the shortcode, as I need to use a new template style. So i want to create a function to list 20 posts in the category networks. What should be my post type, taxonomy, and terms?
What do I need to change in my arg:
add_shortcode( ‘list-posts-basic’, ‘rmcc_post_listing_shortcode1’ );
function rmcc_post_listing_shortcode1( $atts ) {
ob_start();
$query = new WP_Query( array(
‘post_type’ => ‘listings’,
‘posts_per_page’ => -1,
‘order’ => ‘ASC’,
‘orderby’ => ‘title’,
‘taxonomy’ => ‘networks’,
) );
if ( $query->have_posts() ) { ?>
<ul class=”networks”>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<li id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
“><?php the_title(); ?>
<?php endwhile;
wp_reset_postdata(); ?>
<?php $myvariable = ob_get_clean();
return $myvariable;
}
}
Members Only Content
This reply is for PremiumPress customers only.
Login Now