Ok I am trying to get a custom post type working with a couple of fields for the most part it works and outputs the data but instead of each team member it is display the same team member multiple times.
function team(){
// args
$args = array(
'numberposts' => -1,
'post_type' => 'team-member'
);
// query
$the_query = new WP_Query( $args );
if( $the_query->have_posts() ):
while( $the_query->have_posts() ) : $the_query->the_post();
?>
<sction class="row ev-home-4">
<div class="col-sm-12 owl-carousel owl-theme" id="teams">
<div class="item ev-home-4-block">
<a href="<?php the_permalink(); ?>">
<img src="<?php the_field('photo'); ?>" class="img-responsive" />
<div class="row row2 ev-home-4-block-2">
<h2><?php the_title(); ?></h2>
<small><?php the_field('description'); ?></small>
</div>
</a>
</div>
</div>
</div>
</sction>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<?php wp_reset_query(); // Restore global post data stomped by the_post().
https://i.stack.imgur.com/gK5Op.jpg
I dont have a rep of ten so dont no how to add an image sorry about that.
Edit 2 Screen shot to show different data.
https://i.stack.imgur.com/pH1Pi.jpg
Screen shot to show differnt photos for data
Teammember 1
https://i.stack.imgur.com/YmT2B.jpg
Team Member 2
https://i.stack.imgur.com/aChN4.jpg
The above is what it should be printing out.
Edit 3 Ok So i have the team members showing fine now but its showing one below another instead of left to right
function team(){
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => array('team-member'),
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'date',
'posts_per_page' => 6,
'paged' => $paged,
);
// WP_Query
$eq_query = new WP_Query( $args );
if ($eq_query->have_posts()) : // The Loop
?>
<sction class="row ev-home-4">
<?php
while ($eq_query->have_posts()): $eq_query->the_post();
?>
<div class="item ev-home-4-block" style="float:left;">
<img src="<?php the_field('photo'); ?>" class="img-responsive" />
<div class="row row2 ev-home-4-block-2">
<h2><?php the_field('name'); ?></h2>
<small><?php the_field('desciption'); ?></small>
</div>
</div>
</div>
<?php endwhile; wp_reset_query(); ?>
<?php include(EQ_PAGING); ?>
<?php endif;
return $cnt;
}
add_shortcode('team','team');
As you see here it is showing it below the other pic when they should be to the right of each other