Hey,
I created a list of events and want it to show all events on one page (rather than just 5 at once). I know that I’ve already read it somewhere here, but I can’t remember where and I don’t seem to be able to find it again.
So can you please post the piece of code (and where to put it exactly) for that again?
Thank you
Cindy
You can use the eo_events
shortocde (see docs), and set the numberposts attribute to -1.
`[eo_events numberposts=-1 showpastevents=true]`
Stephen Harris
Yeah thanks. I already knew about the shortcode, but I want to change it in the event-archive.php so that I can create a menu and the event list is shown there
(Maybe it’s easier to understand if I just give you the link:
http://potpourridersensationen.de
You can see the Menu ‘OSCAR BUZZ 2013 – SCHEDULE’ on the top
If you click on that you see 5 Events, an the next/prev Buttons (I don’t know why the default gives them to me twice, but be it as it may, since I only want one list anyway). Now, I only want them all to be seen on one page, but I don’t know where to insert the short code. Since I only created a menu button that links to the page http://potpourridersensationen.de/events/event/ there is nowhere to insert it there. That’s why I wanted to change it in the event-archive.php)
Hope, I could make myself clear. I don’t know how to explain it better. I’m sorry.
Cindy
Ok, then the following should do what you’re after. Ideally it should go in a ‘site functionality plugin’ (see this article: http://wpcandy.com/teaches/how-to-create-a-functionality-plugin/). Alternatively you can put it in your (child) theme’s functions.php. You shouldn’t edit the plug-in files as changes will be lost when you update – and putting it in template files is ‘too late’ for the code to take effect.
add_action( 'pre_get_posts', 'cindy_show_all_events' );
function cindy_show_all_events( $query ){
if( $query->is_main_query() && 'event' == $query->get( 'post_type' ) ){
$query->set( 'posts_per_page', -1 );
}
}
Hope that helps!
Stephen
Stephen Harris
Yeah. it worked. Thanks a lot!
Cindy