Support

Account

Forum Replies Created

  • Got the code working in the end this is the finished piece

    http://hastebin.com/dufucamaja.xml

  • I am printing my query out and this is what its selecting in the db
    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)
    INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id) WHERE 1=1 AND wp_posts.post_type = ‘videos’ AND (wp_posts.post_status = ‘publish’ OR wp_posts.post_status = ‘private’) AND ( (wp_postmeta.meta_key = ‘speaker’ AND CAST(wp_postmeta.meta_value AS CHAR) = ‘161’)
    AND (mt1.meta_key = ‘event’ AND CAST(mt1.meta_value AS CHAR) = ’43’) ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10

    but i cannot get anything to print

  • Hi Elliot thanks for your replys and help on this i have edited the query to what you have said.
    http://pastebin.com/T8bV9JVB

  • Hi Elliot thank you for the reply. im not with the project yet but i just rewrote some of it. would this work do you think?

    <?php
    /** Template Name: Events Page **/
    ?>
    <?php Utilities::get_template_parts( array( 'parts/shared/html-header', 'parts/shared/header' ) ); ?>
    <div class="wrapper">
     
     
     
    <?php query_posts(array( 'post_type' => 'events','meta_key' => 'date','orderby' => 'meta_value_num','order' => 'DESC' ) );?>
                           
                            <?php while (have_posts()) : the_post();?>
                            <?php $date = DateTime::createFromFormat('Ymd', get_field('date'));?>
                            <?php $currentdate = new DateTime();?>
                            <?php if ($date > $currentdate) { ?>
                            <div class="event-wrapper">
                                    <h1>Upcoming Event : <?php the_title();?></h1>
                                    <div class="row event-wrap">
                                            <div class="span_4 event-info">
                                                    <h2>Event information</h2>
                                                   
                                                   
                                                   
                                                    <img />" />
                                                    <p><?php echo $date->format('l jS F Y'); ?> , <?php the_field('time');?></p>
                                                    <p><?php the_field('event_location_');?></p>                   
                                                    <button class="buttons">Become a speaker</button>
                                                    <button class="buttons">Book Tickets</button>
                                            </div>
                                           
                                            <div class="span_8 event-speakers">
                                                    <h2>Speakers</h2>
                                                   
                                                    <div class="row">
                                                            <?php
                                                            $speakers = get_field('speakers');
                                                            if( $speakers ): ?>
                                                            <?php foreach( $speakers as $speaker): ?>
                                                            <div class="span_6 speaker">
                                                                    <div class="span_5">
                                                                            <img />" />
                                                                           
                                                                    </div>
                                                                   
                                                                    <div class="span_7">
                                                                            <h3><?php the_title();?></h3>
                                                                           
                                                                           <?php
    																			$args = array(
    																			  'post_type' => 'videos',
    																			  'meta_query' => array(
    																				'relation' => 'AND',
    																				array(
    																				 'key' => 'speaker',
    																				 'value' => get_the_ID()
    																				),
    																				array(
    																				 'key' => 'events',
    																				 'value' => $eventid
    																				)
    																			  )
    																			);
    
    																			$videos = new WP_Query($args);
    
    																			if($videos->have_posts()) : 
    																			   while($videos->have_posts()) : 
    																				  $videos->the_post();
    
    																			?>
    
    																			<!-- STUFF FOR EACH VIDEO HERE -->
    																			<?php the_field('youtube_videos');?>
    
    																			<?php
    
    																			endwhile;
    																			endif;
    
    																			?>
                                                                    </div>
                                                            </div>
                                                           
                                                            <?php endforeach; ?>
                                                            <?php wp_reset_postdata(); ?>
                                                            <?php endif; ?>
                                                            </div>
                                            </div>
                                    </div>
                            </div>
                            <?php } ?>
                            <?php endwhile;?>
    </div>                 
     
    <?php Utilities::get_template_parts( array( 'parts/shared/footer','parts/shared/html-footer' ) ); ?>
  • This reply has been marked as private.
  • 									<?php $videos = get_posts(array(
    									  'post_type' => 'videos',
    									  'meta_query' => array(
    										'relation' => 'AND',
    										 array(
    										   'key' => 'speaker', 
    										   'value' => get_the_ID()
    										 ),
    										 array(
    										   'key' => 'events', 
    										   'value' => $eventid
    										 )
    									   )
    									)); 
    									?>
    									
    									<?php $videoquerys = new WP_Query($videos); ?>
    						

    I cam up with trying this inside the foreach(speaker) but i still can’t get the information to show would really appreciate help

  • http://pastebin.com/9UzpCfmx

    Thats my code, so each event should list all speakers and info and then on a speaker it will show their video for that event and the topic.

    Any help would really be appreciated.

  • Also i have changed my speakers to be able to have a repeater field as the topic , so if they speak more than once they can add a topic for each event they spoke at. i was wondering how i would query that also?

Viewing 9 posts - 1 through 9 (of 9 total)