• Resolved Dave Loodts

    (@davelo)


    I’ve written -thanks to this forum- this function which calls a number of events from a wp_query.
    Now i want to insert a ‘Make a reservation’ button only for the events where reservation is allowed.
    Can somebody give me some advice how to insert a ‘booking possible’-check ?
    Thanks !

    function the_recent_agenda ($post_num=5){ 
    
    		$args = array(
    		'post_type' => 'event',
    		'posts_per_page' => 100,
    		'meta_query' => array( 'key' => '_start_ts', 'value' => current_time('timestamp'), 'compare' => '>=', 'type'=>'numeric' ),
    		'orderby' => 'meta_value_num',
    		'order' => 'ASC',
    		'meta_key' => '_start_ts',
    		'meta_value' => current_time('timestamp'),
    		'meta_value_num' => current_time('timestamp'),
    		'meta_compare' => '>='
    	);
    
    		$query = new WP_Query( $args );
    
    		// The Loop
    	while($query->have_posts()):
    	$query->next_post();
    	$id = $query->post->ID;
    		?>
      <div class="span3">
        <div class="BlogArticle">
          <div class="ImgWrap"><span class="date">
          <?php $eventd = get_post_meta($id, '_event_start_date', true);
    	  $eventok = strtotime($eventd);
    	  ?>
            <?php echo date("M", $eventok); ?>
            <br />
            <span>
            <?php echo date("d", $eventok); ?>
            </span></span>
            <?php if(has_post_thumbnail($id)){ 
    
                                 ?>
            <a href="<?php echo get_permalink($id); ?>">
            <?php echo get_the_post_thumbnail($id); ?>
            </a>
            <?php
    
                            } else{
                                ?>
            <a href="<?php echo get_permalink($id); ?>"><img src="<?php echo get_template_directory_uri();?>/images/03.jpg" alt=""></a>
            <?php
                            }?>
          </div>
          <div class="WhiteTone"> <a href="<?php echo get_permalink($id); ?>"><span class="title">
            <?php echo get_the_title($id);  ?>
            </span></a>
    
          </div>
        </div>
      </div>
      <?php
    endwhile;
    }

    http://wordpress.org/plugins/events-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP_Query: button in event list’ is closed to new replies.