Event order the wrong way around

Home Forums Calendar Products Events Calendar PRO Event order the wrong way around

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #998322
    Filip
    Participant

    OK, so now I do this

     <div id="stadspodium">
    	    <?
    	    // Retrieve events
    	    $events = tribe_get_events( array(
    		    'posts_per_page' => 3,
    		    'tax_query' =>  array(
    			    array(
    			    'taxonomy' => 'tribe_events_cat',
    			    'field' => 'slug',
    			    'terms' => array('grotekerkplein'),
    			    'operator' => 'NOT IN'
    			    )
    		    ),
    		    'start_date' => new DateTime()
    	    ) );
    	    // setup thumbnails
    	    $spr_id = get_post_thumbnail_id($event->ID);
    	    $spr_url = wp_get_attachment_image_src($spr_id,'medium');
    	    $spr_url = $spr_url[0];
    	    // Loop through the events, displaying the title
    	    foreach ( $events as $event ) { ?>
    		    <article style="background: url(<? echo $spr_url ?>) center no-repeat; background-size: cover">
    
    			    <div class="meta">
    				    <!--what-->
    				    <? echo str_replace(
    					    ':',
    					    '',
    					    tribe_get_event_categories($event->ID, array('label'=>''))
    				    ); ?>
    				    <!--when-->
    				    <?php if (tribe_get_start_date() !== tribe_get_end_date() ) { ?>
    				    <span class="when">
                     <?php echo tribe_get_start_date($event->ID, false, 'j F Y H:i'); ?> - <?php echo tribe_get_end_date($event->ID, false, 'H:i'); ?>
    					    <?php } else { ?>
    						    <?php echo tribe_get_start_date($event->ID, false, 'j F Y H:i'); ?>
    					    <?php } ?></span>
    				    <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a></h1>
    			    </div>
    		    </article>
    	    <?}
    	    ?>
    
    </div>
    <div id="grotekerk">
    
    	<?
    	// Retrieve upcoming events
    	$events = tribe_get_events( array(
    		'posts_per_page' => 4,
    		'tax_query' =>  array(
    			array(
    				'taxonomy' => 'tribe_events_cat',
    				'field' => 'slug',
    				'terms' => array('grotekerkplein'),
    				'operator' => 'IN'
    			)
    		),
    		'start_date' => new DateTime()
    	) );
    	// setup thumbnails
    	$gkp_id = get_post_thumbnail_id($event->ID);
    	$gkp_url = wp_get_attachment_image_src($gkp_id,'medium');
    	$gkp_url = $gkp_url[0];
    	// Loop through the events, displaying the title
    	foreach ( $events as $event ) { ?>
    		<article style="background: url(<? echo $gkp_url ?>) center no-repeat; background-size: cover">
    			<div class="meta">
    				<!--what-->
    				<? echo str_replace(
    					':',
    					'',
    					tribe_get_event_categories($event->ID, array('label'=>''))
    				); ?>
    				<!--when-->
    				<?php if (tribe_get_start_date() !== tribe_get_end_date() ) { ?>
    				<span class="when">
                     <?php echo tribe_get_start_date($event->ID, false, 'j F Y H:i'); ?> - <?php echo tribe_get_end_date($event->ID, false, 'H:i'); ?>
    					<?php } else { ?>
    						<?php echo tribe_get_start_date($event->ID, false, 'j F Y H:i'); ?>
    					<?php } ?></span>
    				<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a></h1>
    			</div>
    		</article>
    	<?}
    	?>
    </div>

    This gets me 3 events with the same featured image and the wrong events in Stadspodium, and in Grotekerkplein the same 4 events with another featured image, and supposedly the right category (but when in fact: the wrong category). Please help me solve this mess, so I can move on to profitable projects. Thanks.

    #998326
    Filip
    Participant

    Ok, thumbnails were outside of foreach, so those work (my bad). The dates are probably correct, now only for the titles (and permalinks).

    #998328
    Filip
    Participant

    And solved, apparently there setup_postdata does not prevent having to call $event->ID all the time and echoing works better than just outputting results. Phew. In comparison this is what the competion needs for about the same result echo do_shortcode([event_list limit=3 category="3"]);

    FWIW we run php5.5 local and php5.4 remote; nothing too outdated for that, as I’m sure you agree.

    As for documentation: I’d focus on theme developers, the documentation is either too simple/generic, or too hardcore and riddled with links to the codex. For this specific issue there were at least 4 possible solutions, both inside and outside the documentation. That just confuses people, I’m sure.

    #998640
    George
    Participant

    Thank you for your feedback about our documentation, Filip. I’m not just saying that to be a “polite customer support person” – your comments, especially here at the end, are valuable ones and I think you make a good point about how we have things organized!

    Best of luck with your site,
    George

    #1002882
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 16 through 20 (of 20 total)
  • The topic ‘Event order the wrong way around’ is closed to new replies.