{"id":1251291,"date":"2017-03-08T12:07:05","date_gmt":"2017-03-08T20:07:05","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/"},"modified":"2017-03-08T12:07:05","modified_gmt":"2017-03-08T20:07:05","slug":"creating-custom-wp-queries","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/","title":{"rendered":"Creating custom WP queries"},"content":{"rendered":"<p>Hi there, we need to create various bespoke calendar pages for a couple of sites we are building.<\/p>\n<p>I&#8217;ve read the following &#8211; https:\/\/theeventscalendar.com\/knowledgebase\/using-tribe_get_events\/ &#8211; and broadly understand it but am not sure of where this code sits in the markup for the whole page. <\/p>\n<p>My current page query is show below. It&#8217;s a hatchet job and works, but doesn&#8217;t give me the control over all of the args like your code does. What *should* may code be for the whole page please?<\/p>\n<p>&lt;?php \/* Template Name: Page Event *\/ ?&gt;<br \/>\n&lt;?php get_header(); ?&gt;<br \/>\n&lt;div class=&#8221;container&#8221;&gt;<br \/>\n    &lt;div class=&#8221;row&#8221;&gt;<br \/>\n        &lt;main class=&#8221;col-sm-8 main-content&#8221;&gt;<br \/>\n            &lt;?php<br \/>\n                $args = array(<br \/>\n                    &#8216;post_status&#8217;=&gt;&#8217;publish&#8217;,<br \/>\n                    &#8216;post_type&#8217;=&gt; &#8216;tribe_events&#8217;,<br \/>\n                    &#8216;posts_per_page&#8217;=&gt;20,<br \/>\n                );<br \/>\n                $get_posts = null;<br \/>\n                $get_posts = new WP_Query();<br \/>\n                $get_posts-&gt;query($args);<br \/>\n                if($get_posts-&gt;have_posts()) : while($get_posts-&gt;have_posts()) : $get_posts-&gt;the_post(); ?&gt;<br \/>\n                    <a>&#8220;&gt;<\/p>\n<h6>&lt;?php the_title(); ?&gt;<\/h6>\n<p>                    <\/a>&lt;br \/&gt;<br \/>\n                &lt;?php if (tribe_get_start_date() !== tribe_get_end_date() ) { ?&gt;<br \/>\n                &lt;?php echo tribe_get_start_date(); ?&gt; &#8211; &lt;?php echo tribe_get_end_date(); ?&gt;<br \/>\n                &lt;?php } else { ?&gt;<br \/>\n                &lt;?php echo tribe_get_start_date(); ?&gt;<br \/>\n                &lt;?php } ?&gt;<br \/>\n                &lt;?php the_excerpt(); ?&gt;<br \/>\n                &lt;?php<br \/>\n                    endwhile;<br \/>\n                    endif;<br \/>\n                    wp_reset_postdata();<br \/>\n            ?&gt;<br \/>\n        &lt;\/main&gt;<br \/>\n        &lt;aside class=&#8221;col-sm-4 sidebar-content&#8221;&gt;<br \/>\n        &lt;\/aside&gt;<br \/>\n    &lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;?php get_footer(); ?&gt; <\/p>\n","protected":false},"template":"","class_list":["post-1251291","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>Creating custom WP queries -<\/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\/creating-custom-wp-queries\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating custom WP queries -\" \/>\n<meta property=\"og:description\" content=\"Hi there, we need to create various bespoke calendar pages for a couple of sites we are building. I&#8217;ve read the following &#8211; https:\/\/theeventscalendar.com\/knowledgebase\/using-tribe_get_events\/ &#8211; and broadly understand it but am not sure of where this code sits in the markup for the whole page. My current page query is show below. It&#8217;s a hatchet [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/\" \/>\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\/creating-custom-wp-queries\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/\",\"name\":\"Creating custom WP queries -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-03-08T20:07:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/#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\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Creating custom WP queries\"}]},{\"@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":"Creating custom WP queries -","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\/creating-custom-wp-queries\/","og_locale":"en_US","og_type":"article","og_title":"Creating custom WP queries -","og_description":"Hi there, we need to create various bespoke calendar pages for a couple of sites we are building. I&#8217;ve read the following &#8211; https:\/\/theeventscalendar.com\/knowledgebase\/using-tribe_get_events\/ &#8211; and broadly understand it but am not sure of where this code sits in the markup for the whole page. My current page query is show below. It&#8217;s a hatchet [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/","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\/creating-custom-wp-queries\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/","name":"Creating custom WP queries -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-03-08T20:07:05+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/creating-custom-wp-queries\/#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":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Creating custom WP queries"}]},{"@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\/1251291","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\/1251291\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1251291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}