BlueAirplane
Veteran
Just Getting Started
Member Likes (0)
I've done my research on these boards, but haven't found a successful solution. I'm simply trying to display at least the next 20-30 upcoming events (I realize there are current limitations on this with the plugin).
My catch is that I'm only seeing 10 upcoming events. I would be happy if I could have 20-30 even if it's a hack for the time being. Any suggestions? Below is my code on my template page:
<?php query_posts($query_string . '&orderby=date&order=ASC'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<div id="event-post">
<h2 class="posttitle"><?php echo get_the_title($ID); ?></h2>
<?php the_content(); ?>
</div>
<?php endwhile; endif; ?>
I have alternatively tried this code instead (found in another thread), but still I only get 10 events listed:
<?php query_posts( array( 'post_status' => 'publish' , 'post_type' => array( 'incsub_event' ) , 'meta_key' => 'incsub_event_start' , 'orderby' => 'meta_value' , 'order' => 'ASC' ) ); ?>
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<div id="event-post">
<h2 class="posttitle"><?php echo get_the_title($ID); ?></h2>
<?php the_content(); ?>
</div>
<?php endwhile; endif; ?>

Responses (5)
People Person (joined February 2012) Likes (0)
Blue Airplane,
Your code is cut off pretty severely so I cannot see it, so sorry. perhaps if you repost it?
The event listing is a custom post type, perhaps changing the value in the Dashboard>Settings>Reading for "blog pages show at most" (by default it is 10)
Best
Kimberly
Developer (joined January 2012) Likes (0)
@BlueAirplane, This should be simple enough. Have you checked the WordPress Codex for query_posts? http://codex.wordpress.org/Function_Reference/query_posts
In both your example you can add the parameter 'numberposts' which will display that number of items. That parameter will override the default Setting pointed out by Kimberly.
Alternately, you can use the other WordPress WP_Query
http://codex.wordpress.org/Class_Reference/WP_Query
Developer (joined January 2012) Likes (0)
One other comment. On your second code set you have added post_type as an array. This is incorrect.
'post_type' => array( 'incsub_event' )
Should be just
'post_type' => 'incsub_event'
Member (joined December 2011) Likes (0)
Thanks for the help!
I got it working with the code below. I had to use posts_per_page instead of numberposts in the query to override the WP Default.
Developer (joined January 2012) Likes (0)
Yeah, I forget 'post_per_page'. Really wish WordPress core would standardize on the various parameters.
Become a member