Support

Account

Home Forums General Issues categorize post by month whit date picker

Solving

categorize post by month whit date picker

  • i want categorize by month with date picker
    for exapmle:

    -Months select-
    jan ===-click-====>(show All post of january, and hide the other post.)
    feb *
    mar *
    etc.. *
    ————— *
    *
    <post of january only>

    of course, according only of datepicker value in the custom post type,
    some idea?

  • http://codex.wordpress.org/Class_Reference/WP_Meta_Query

    if (isset($_GET['month'])):
      $args = array(
        'post_type' => 'any',
        'meta_query' => array(
                            array(
                                  'key' => 'YourAcfDateFieldKey',
                                  'value' => $_GET['month'],
                                  'compare' => 'LIKE'
                                  )
                            )
      );
    
      $myposts = get_posts($args);
    endif;

    try something like that

  • is good, but no get the variable month in the the datepicker, i’ve tried print the
    value whit echo but no display the array of months, and i’ve tried a assign a url in the event page to the single:
    myweb.com/event/?month=september
    but is not enough

  • my code was just for example, you can add event listener onchange to your datepicker so when it will change pass to url with get parameter and modify the WP_Query object acording the request

  • I’m not really sure what you trying to do, so just offering methods

  • also you can load all post into page and then sort em using jQuery using datepicker as sorting data provider for example

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘categorize post by month whit date picker’ is closed to new replies.