Support

Account

Home Forums Front-end Issues Date picker language front-end Reply To: Date picker language front-end

  • Ok, solved it now. Not the most beautiful solution but it works:

    <?php if (have_posts()) :

    $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1;
    $today = date( ‘Ymd’, strtotime( ‘-1 day’ ) );

    query_posts( array(
    ‘post_type’ => ‘agenda’,
    ‘meta_key’ => ‘datum_event’,
    ‘orderby’ => ‘meta_value_num’,
    ‘order’ => ‘ASC’,
    ‘posts_per_page’ => 12,
    ‘paged’ => $paged,

    ‘meta_query’ => array(
    array(
    ‘key’ => ‘datum_event’,
    ‘meta-value’ => $today,
    ‘value’ => $today,
    ‘paged’ => $paged,
    ‘compare’ => ‘>’ // DEZE AANPASSEN OM OUDE ITEMS TE LATEN ZIEN
    )
    )

    ) );

    date_default_timezone_set( ‘Europe/Amsterdam’ );
    setlocale( LC_ALL, ‘nl_NL’ ) or setlocale( LC_ALL, ‘nld_NLD’ );

    $months = explode( ‘,’, ‘,jan,feb,mrt,apr,mei,jun,jul,aug,sep,okt,nov,dec’ );

    while (have_posts()) : the_post();

    $date = DateTime::createFromFormat( ‘Ymd’, get_field( ‘datum_event’ ), new DateTimeZone( ‘Europe/Amsterdam’ ) );
    ?>

    <p class=”jaar”><?php echo $date->format( ‘Y’ ); ?></p>
    <p class=”dag”><?php echo $date->format( ‘j’ ); ?></p>
    <p class=”maand”><?php echo $months[ $date->format( ‘n’ ) ]; ?></p>