Problem getting values. value is allways the same
-
Hey,
I’m having some problems with the output of the repeater fields.
this is the origional query i want to make repeatable with Ajax load more:
<?php $type = 'event'; $args= array( 'post_type' => $type, 'posts_per_page' => 3, ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts()) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php global $post; ?> <?php $image_id = get_post_thumbnail_id(); ?> <?php $image_url = wp_get_attachment_image_src($image_id,'large', true); ?> <?php $check= get_post_meta($post->ID, 'youtube-video-code', true); ?> <?php if (!empty($check)) { ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="event-block"> <div class="small-12 medium-4 large-4 columns"> <?php $url = $check; parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars ); ?> <div class="post-image" style="background-image: url(http://img.youtube.com/vi/<?php echo $my_array_of_vars['v']; ?>/0.jpg);"> </div> <div class="post-info"> <div class="row"> <div class="small-12 columns"> <h3><?php the_title(); ?></h3> <?php $num = get_post_custom_values('aantal-deelnemers-per-evenement', get_the_ID( $post->ID )); ?> <p><?php echo $num[0]; ?> PEOPLE SANG FOR THE CLIMATE</p> </div> </div> </div> </div> </a> <?php } else { ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="event-block"> <div class="small-12 medium-4 large-4 columns"> <div class="post-image" style="background: #16e19f;"> <div class="date-wrap"> <?php $temp = get_template_directory_uri(); ?> <?php echo do_shortcode('[event]<img src="'. $temp .'/img/kalender-icon.svg" width="10px" height="11px" alt=""/><div class="date-wrap-inner"><span class="day">#d</span><span class="month">#F</span></div><span class="year">#Y</span>[/event]'); ?> </div> </div> <div class="post-info"> <div class="row"> <div class="small-12 columns"> <h3><?php the_title(); ?></h3> <p><?php echo do_shortcode('[event]#d.#m.#Y — STARTS AT #h:#m[/event]'); ?></p> </div> </div> </div> </div> </a> <?php } ?> <?php endwhile; } wp_reset_query(); ?>There are 2 different views that i impletented in the custom repeaters:
This one is the first:<?php global $post; ?> <?php if (!empty($check)) { ?> <?php $check= get_post_meta($post->ID, 'youtube-video-code', true); ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="event-block"> <div class="small-12 medium-4 large-4 columns"> <?php $url = $check; parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars ); ?> <div class="post-image" style="background-image: url(http://img.youtube.com/vi/<?php echo $my_array_of_vars['v']; ?>/0.jpg);"> </div> <div class="post-info"> <div class="row"> <div class="small-12 columns"> <h3><?php the_title(); ?></h3> <?php $num = get_post_custom_values('aantal-deelnemers-per-evenement', get_the_ID( $post->ID )); ?> <p><?php echo $num[0]; ?> PEOPLE SANG FOR THE CLIMATE</p> </div> </div> </div> </div> </a <?php } ?>This is the shortcode i used:
<?php echo do_shortcode('[ajax_load_more post_type="event" posts_per_page="3" scroll="true"]'); ?>And this is the second:
<?php echo do_shortcode('[ajax_load_more repeater="template_1" post_type="event" posts_per_page="3" max_pages="0"]'); ?>Everything works perfect with the first query but both of them output fields but always the same value. How is this possible?
Do i need to write a extra query inside the repeater fields or is it a problem with displaying fields of the wp-event plugin?Little bit stuck here 🙂
Thanks in advance!
The topic ‘Problem getting values. value is allways the same’ is closed to new replies.