Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* shortcode voor data home widget*/
- add_shortcode( 'kalenderlijst', 'list_kalender' );
- function list_kalender( $atts ) {
- ob_start();
- wp_reset_postdata();
- $today = date('Ymd');
- extract( shortcode_atts( array (
- 'type' => 'kalender',
- 'posts' => 3,
- 'category' => '',
- ), $atts ) );
- $options = array(
- 'post_type' => $type,
- 'posts_per_page' => -1,
- 'order' => 'ASC',
- 'orderby' => 'meta_value_num',
- 'meta_key' => 'datum',
- 'meta_query' => array(array('key' => 'datum', 'value' => $today, 'compare' => '>'))
- );
- $query = new WP_Query( $options );
- if ( $query->have_posts() ) { ?>
- <div id="workshopslist1" class="row">
- <?php while ( $query->have_posts() ) : $query->the_post(); ?>
- <div class="kalenderblock row collapse">
- <div class="small-1 large-2 columns ">
- <a href="<?php the_permalink(); ?>"><?php echo the_post_thumbnail(); ?></a>
- </div>
- <div class="small-10 large-9 columns">
- <h5><span class="kalico date"><?php $date = get_field('datum', false, false); $date = new DateTime($date);
- echo $date->format('l j F Y'); ?></span><span class="kalico time"><?php echo the_field('tijdstip'); ?></span></h5>
- <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
- <p><?php echo the_field('locatie'); ?></p>
- </div>
- </div>
- <?php endwhile;
- ?>
- </div>
- <?php $myvariable = ob_get_clean();
- return $myvariable;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement