Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress Custom Post Type Organize by Month
    text
    copied!<p>I've seen a lot of these questions asked but havent quite figured out how to do it. What I have is a custom post type called "games" and in that I have custom field called "ecpt_date". Essentially what Im trying to do is make a schedule for a sports team website I've created.</p> <p>Ive seen questions and answers for displaying custom post types based on todays date, I've actually got that working on my website to display an upcoming game and the latest game.</p> <p>What Im wanting to do is organize our schedule into months so I can display all games from September, October, November etc separately. </p> <p>I've managed to get all games displayed with a different query but havent had much luck trying to filter through the games based on "ecpt_dates" month. Im assuming it has something to do with the date value in meta_query but am unsure of how to proceed. I can get the date and display it I just cant order my custom posts by it. </p> <p>Here is the query Im trying. </p> <pre><code>$posts = new WP_Query( array( 'post_type' =&gt; 'games', 'showposts' =&gt; 10, 'meta_key' =&gt; 'ecpt_date', 'orderby' =&gt; 'meta_value', 'order' =&gt; 'ASC', 'meta_query' =&gt; array(array( 'key' =&gt; 'ecpt_date', 'value' =&gt; date(Assuming I use this), 'type' =&gt; 'DATE' )) )); </code></pre> <p>From my understanding it's because of the way the time is formatted in a custom field. Im not a php expert by any means but am hoping someone can give me some tips or ideas on how I could solve this or if its possible.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload