joern

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Creating a Link to /all-View page #1520153
    joern
    Participant

    Hi Jeremy,

    thanks a lot for the hint, but it’s not working for me. I have regular and recuring events and for them i get with that a link like …/<slug>/<eventname>/<date>/all but i always need …/<slug>/<eventname>/all.

    <?php
    /**
     * @package WordPress
     * @subpackage Wheels
     *
     * Template Name: Kursnamen
     */
    get_header();
    
     $querystr = "
        SELECT $wpdb->posts.* 
        FROM $wpdb->posts
        WHERE $wpdb->posts.post_status = 'publish' 
        AND $wpdb->posts.post_type = 'tribe_events'
    	AND $wpdb->posts.post_parent = 0
        AND $wpdb->posts.post_date < NOW()
        ORDER BY $wpdb->posts.post_title ASC
     ";
    
     $pageposts = $wpdb->get_results($querystr, OBJECT);
    
    /*
     global $post;
    $current_date = date(‘j M Y’);
    $end_date = date(‘j M Y’, strtotime(‘+1 week’));
    
    $all_events = tribe_get_events(
    array(
    ‘eventDisplay’ => ‘upcoming’,
    ‘start_date’ => $current_date,
    ‘end_date ‘=> $end_date,
    ‘posts_per_page’ => 5,
    ‘tax_query’=> array(
    array(
    ‘taxonomy’ => ‘tribe_events_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => $blog_cat
    )
    )
    )
    );
    
    foreach($all_events as $post) {
    setup_postdata($post);
    ?>
    
    */
    
    ?>
    <?php get_template_part( 'templates/title' ); ?>
    <div class="<?php echo school_time_class( 'main-wrapper' ) ?>">
    	<div class="<?php echo school_time_class( 'container' ) ?>">
    		<div class="<?php echo school_time_class( 'content-fullwidth' ) ?>">
    			
    	<h2 class="kurseRow">h2 Header</h2>	
    	<p>
    		Some text here
    		<br/>			
    	</p>		
    	
    	<h3 class="kurseRow">Kursübersicht</h3>
    			
    	 <?php if ($pageposts): ?>
    	  <?php global $post; 
    	    $i = 0; ?>
    		  
      		<table id="tablepress-4" class="tablepress tablepress-id-4">
      		<caption style="caption-side:bottom;text-align:left;border:none;background:none;margin:0;padding:0;"></caption>
      		<tbody class="row-hover">
    		  
    		  
    		  
    	  <?php 
    	  $i = 0;
    	  foreach ($pageposts as $post): ?>
    	    <?php setup_postdata($post); ?>
    		
    		<tr class="row-<?php the_ID(); ?> odd <?php 		
    		$i++;
    		
    
    		$zahl=$i;
    		if ($zahl % 2 != 0) {
    		echo "even";
    		} else {
    		echo "odd";
    		}	
    		
    ?>	 ">
    			
    			<td class="column-1">
    				
    				
    				<?php
    				
    				
    				$event_cats_args = array(
    				    'orderby' => 'name',
    				    'order'   => 'ASC',
    				    'fields'  => 'all'
    				);
     
    				$event_id = get_the_ID();
    				$event_cats = wp_get_object_terms( $event_id, array( 'tribe_events_cat' ), $event_cats_args );
    				
    				// Assume $event_id exists from somewhere above in this hypothetical code.
     
    				$event_cats = wp_get_object_terms( $event_id, array( 'tribe_events_cat' ) );
     
    				if ( empty( $event_cats ) ) {
    				    return;
    				}
     
    				if ( is_wp_error( $event_cats ) || ! is_array( $event_cats ) ) {
    				    return;
    				}
     
    				// Echo the names of the categories attached to this event.
    				foreach( $event_cats as $cat ) {
    				    echo esc_html( $cat->name ) . '<br>';
    				}
    				
    				 ?>
    			
    			</td>
    
    			<td class="column-2 permalink"><a href="<?php tribe_get_event_website_url() ?>" rel="bookmark" title="Link zu <?php the_title_attribute(); ?>"><?php the_title();?> - Event test</a>
    
    			<td class="column-2 tribe_get_event_link"><a href="<?php echo tribe_get_event_link( $event->ID ) ?>" rel="bookmark" title="Link zu <?php the_title_attribute(); ?> - ">
    		  	<?php 
    		  		the_title(); 
    				echo tribe_get_event_meta( $post_id, '_EventURL', true );
    		 	 ?>
    		  </a>
    		  </td>
    		</tr>
    	
    	  <?php endforeach; ?>
    	</tbody>
    	</table>
    	  <?php else : ?>
    	    <h2 class="center">Keine Eintrag</h2>
    	    <p class="center">Sorry, es wurden keine veranstaltungen gefunden.</p>
    	    <?php include (TEMPLATEPATH . "/searchform.php"); ?>
    	 <?php endif; ?>
    			<?php get_template_part( 'templates/content-page' ); ?>
    		</div>
    	</div>
    </div>
    <?php get_footer(); ?>
    
    
    • This reply was modified 7 years, 11 months ago by joern.
    joern
    Participant

    Hi Victor,

    thx a lot. The shotcodes & filters are pretty cool and i can use them
    at other places, but i cannot solve my problem that way.

    Let me try to explain it a better way;-)

    At the moment i have events like:
    – Event a
    – 1.2.2017 – 5.2.2017
    – 5.2.2017 – 10.2.2017
    – 6.2.2017 – 11.2.2017
    – Event b
    – 1.3.2017 – 5.3.2017
    – Event c
    – 1.2.2018 – 5.2.2018
    – 5.2.2018 – 10.2.2018
    – 6.2.2018 – 11.2.2018

    What i need, is a (widget?)list with the events and a link to the next event of it:

    We have these events for you:
    – Event a -> link to next date
    – Event b -> link to next date
    – Event c -> link to next date

    Cheers!
    Joern

    • This reply was modified 8 years, 11 months ago by joern.
Viewing 2 posts - 1 through 2 (of 2 total)