{"id":1394763,"date":"2017-11-29T07:07:06","date_gmt":"2017-11-29T15:07:06","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/"},"modified":"2017-11-29T07:07:06","modified_gmt":"2017-11-29T15:07:06","slug":"list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/","title":{"rendered":"List all future and past events with pagination on custom page with WP_Query"},"content":{"rendered":"<p>Hi,<br \/>\nIs it possible to get all events in wp_query not just the future ones?<br \/>\nI have a custom template with custom if while loop and pagination, but all I get is future events&#8230;<br \/>\nI have created loop based on <a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/custom-event-list-pagination\/\">Create a custom list of events with pagination<\/a> and if I set posts_per_page to -1 I get only future events, non of the past is showing&#8230;<\/p>\n<p>This is the code:<br \/>\n<code><br \/>\n&lt;?php<br \/>\n$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;<br \/>\n$upcoming = new WP_Query( array(<br \/>\n\t'post_type'            =&gt; 'tribe_events',<br \/>\n\t'orderby'              =&gt; 'event_date',<br \/>\n\t'order'                =&gt; 'DESC',<br \/>\n\t'tribe_render_context' =&gt; 'default',<br \/>\n\t'posts_per_page'\t=&gt; 1,<br \/>\n\t'paged' =&gt; $paged,<br \/>\n) );<\/p>\n<p>\/\/ If we got some results, let's list 'em<br \/>\nwhile ( $upcoming-&gt;have_posts() ) { $upcoming-&gt;the_post();<br \/>\n $id = get_the_ID();<br \/>\n $date  = tribe_get_start_date($id, false, 'j F');<br \/>\n echo '<\/p>\n<h3>'. $date .'<\/h3>\n<p>';<br \/>\necho '<\/p>\n<h4>'. get_the_title() .'<\/h4>\n<p>';<br \/>\n}<br \/>\n<\/code><\/p>\n","protected":false},"template":"","class_list":["post-1394763","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>List all future and past events with pagination on custom page with WP_Query -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"List all future and past events with pagination on custom page with WP_Query -\" \/>\n<meta property=\"og:description\" content=\"Hi, Is it possible to get all events in wp_query not just the future ones? I have a custom template with custom if while loop and pagination, but all I get is future events&#8230; I have created loop based on Create a custom list of events with pagination and if I set posts_per_page to -1 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/\",\"name\":\"List all future and past events with pagination on custom page with WP_Query -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-11-29T15:07:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Welcome!\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Pre-Sales Questions\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"List all future and past events with pagination on custom page with WP_Query\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"List all future and past events with pagination on custom page with WP_Query -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/","og_locale":"en_US","og_type":"article","og_title":"List all future and past events with pagination on custom page with WP_Query -","og_description":"Hi, Is it possible to get all events in wp_query not just the future ones? I have a custom template with custom if while loop and pagination, but all I get is future events&#8230; I have created loop based on Create a custom list of events with pagination and if I set posts_per_page to -1 [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/","name":"List all future and past events with pagination on custom page with WP_Query -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-11-29T15:07:06+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/list-all-future-and-past-events-with-pagination-on-custom-page-with-wp_query\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Welcome!","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/"},{"@type":"ListItem","position":4,"name":"Pre-Sales Questions","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/_welcome\/pre-sales-questions\/"},{"@type":"ListItem","position":5,"name":"List all future and past events with pagination on custom page with WP_Query"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1394763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1394763\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1394763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}