I am trying to build a content slider so that each slide contains 8 images. To do this I need to add the 'row-fluid' class to every 4 posts and 'slide' class to every 8 posts in my WP query.
HTML of what I am try to achieve -
<div class="coda-slider" id="slider-id">
<div class="slide">
<div class="row-fluid">
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
</div><!-- /row-fluid -->
<div class="row-fluid">
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
</div><!-- /row-fluid -->
</div><!-- /slide -->
<div class="slide">
<div class="row-fluid">
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
</div><!-- /row-fluid -->
<div class="row-fluid">
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
<div class="span3">
<img src="...">
</div>
</div><!-- /row-fluid -->
</div><!-- /slide -->
</div><!-- /coda-slider -->
My query that doesn't work correctly -
<?php
$args = array( 'post_type' => 'video', 'posts_per_page' => 10,);
$the_query = new WP_Query( $args );
echo '<section id="our-clients">';
echo '<div class="coda-slider" id="slider-id">';
$i = 1;
echo '<div class="slide">';
echo '<div class="row-fluid">';
if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();
echo '<div class="span3">';
the_post_thumbnail();
echo '</div>';
if($i % 8 == 0) {echo '</div><div class="slide">';}
elseif($i % 4 == 0) {echo '</div><div class="row-fluid">';}
$i++; endwhile; endif;
echo '</div>'; //row-fluid
echo '</div>'; //slide
echo '</div>'; //coda-slider
echo '</section>';
What the query is printing out -
The php is adding the 'slide' class to every 8 posts but the first 'slide' class isn't closing correctly. This probably sounds really confusing, so let me know if you need additional information.
I appreciate the help!
Try this ;)
<?php
$args = array( 'post_type' => 'video', 'posts_per_page' => 10,);
$the_query = new WP_Query( $args );
echo '<section id="our-clients">';
echo '<div class="coda-slider" id="slider-id">';
for($i=1; $the_query->have_posts(); $i++)
{
$the_query->the_post();
$prePost='';
$postPost='';
if($i==1)
{
$prePost='<div class="slide"><div class="row-fluid">';
}
if($i==4)
{
$prePost='</div><div class="row-fluid">';
}
if($i==8)
{
$postPost='</div></div>';
$i=0;
}
echo $prePost, '<div class="span3">';
the_post_thumbnail();
echo '</div>', $postPost;
}
echo '</div>'; //coda-slider
echo '</section>';
This code is from another answer on SO
How do I add a class to every nth item in a php loop (wordpress)
https://stackoverflow.com/a/12698408/804087
<?php $counter = 1 ?>
<?php $loop = new WP_Query( array( 'post_type' => 'portfolio' ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="four columns <?php if ($counter % 4 == 1){echo 'alpha'}else if ($counter % 4 == 0){echo 'omega'} ?>">
<?php the_content(); //along with other stuff in looped div ?>
</div>
<?php $counter++ ;
endwhile ?>
You may try this using get_posts and array_chunck
$args = array( 'post_type' => 'video', 'posts_per_page' => 10,);
$posts = get_posts($args);
$postGroups = array_chunk($posts, 8);
foreach($postGroups as $group) :
echo "<div class='slide'>";
$slides = array_chunk($group, 4);
foreach($slides as $fluides) :
echo "<div class='row-fluide'>";
foreach($fluides as $video) : setup_postdata($video)
<div class="span3">
// ...
</div>
endforeach;
echo "</div>";
endforeach;
echo "</div>";
endforeach;
Related
I have a problem with this code, I have several buttons with various categories and when you click it it should change what it shows according to the category you have chosen, as I have it now it does not change what it shows, I hope you can help me fellows.
Here is a link of a video that shows the problem:
https://www.loom.com/share/1371ed7d195544269e28197cafd25407
<?php
?>
<?php get_header(); ?>
<?php get_template_part('template_parts/banner-casos-de-exito') ?>
<section class="section">
<div class="container">
<div class="section__body mt-0">
<div class="grid-history">
<div class="row">
<?php
$terms = get_terms('historias-de-exitos');
$count = count($terms);
if ( $count > 0 )
{
?>
<ul id="filters-2" class="clearfix">
<li><span class="filter active" data-filter=".all">Todos</span></li>
<?php
foreach ( $terms as $term )
{
$termname = strtolower($term->name);
$termname = str_replace(' ', '-', $termname);
echo '<li>
<span class="filter" data-filter="' . '.' . $termname . '">
' . $term->name . '
</span>
</li>';
}
?>
</ul>
<?php
}
?>
</div>
<div class="row">
<?php
$loop = new WP_Query(
array(
'post_type' => 'historias-de-exito',
'posts_per_page' => 3,
'post_status' => 'publish',
'order' => 'DESC',
'ignore_sticky_posts' => true
)
);
$count = 0;
?>
<div id="portfoliolist">
<?php
if ( $loop ) :
while ( $loop->have_posts()) : $loop->the_post();
$imagen__portada__exito = get_field( 'imagen__portada__exito' );
$icono__casos__exito = get_field( 'icono__casos__exito' );
?>
<?php
$terms = get_the_terms( $loop->ID, 'historias-de-exitos' );
if ( $terms && ! is_wp_error( $terms ) ) :
$links = array();
foreach ( $terms as $term )
{
$links[] = $term->name;
}
$links = str_replace(' ', '-', $links);
$tax = join( " ", $links );
$link_category = get_term_link( strtolower($tax), 'historias-de-exitos' );
else :
$tax = '';
endif;
?>
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<div class="content__portafolio <?php echo strtolower($tax); ?> all" data-cat="<?php echo strtolower($tax); ?>">
<img src="<?php echo $imagen__portada__exito; ?>" alt="" class="img-fluid">
<div class="content">
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<h2><?php echo get_the_title(); ?></h2>
<div class="sumilla">
<?php echo the_excerpt(); ?>
</div>
<!-- -->
</div>
</div>
<!-- -->
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12">
saber más
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12">
<div class="logo__reiva">
<img src="<?php echo $icono__casos__exito; ?>" alt="" class="img-fluid">
</div>
</div>
</div>
<!-- -->
</div>
<!-- -->
</div>
<!-- -->
</div>
<!-- -->
<?php
endwhile;
endif;
?>
</div>
<!-- -->
<div id="boton">
Cargar más
</div>
<!-- -->
</div>
<!-- -->
</div>
</div>
</div>
</section>
<div id="scrollUp">
<img src="<?php echo get_template_directory_uri(); ?>/assets/img/arrow-scroll.png" alt="">
</div>
<?php get_footer(); ?>
You should try using Ajax to post and receive data. For an example of this check out: jQuery Ajax Post with data
I am creating a portfolio section.the live site is here, http://www.nayeemriddhi.info/testproject/portfolio/. There need three loop for showing item. But fact is that, when i open portfolio item, the right sidebar item showing item from the beginning, as i created the loop. but i want to show right sidebar item as a current item for the portfolio images. is there any idea for showing right sidebar item as a current item.
the code is below,
<?php
/*
Template Name: Portfolio
*/
get_header(); ?>
<!-- Banner -->
<section class="page-banner" >
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="page-title ">Portfolios</h1>
<span class="page-tag-line">See our recent works</span>
</div>
</div>
</div>
</section>
<div class="wave-divider-pages"></div>
<section>
<div class="container gal-container">
<?php
$args = array(
'post_type' => 'custom_portfolio',
'posts_per_page' => '-1',
);
// the query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) ?>
<?php while ( $query->have_posts() ) : $query->the_post() ; ?>
<?php $globalID = get_the_id(); ?>
<!-- Item-->
<div class="col-md-4 col-sm-6 co-xs-12 gal-item">
<div class="box">
<a class="trigger" data-iziModal-open="#modal<?php the_ID(); ?>">
<img src="<?php echo get_post_meta(get_the_ID(), 'portfolio_image', true); ?>">
</a>
</div>
</div>
<!-- Modal-->
<div id="modal<?php the_ID(); ?>" class="iziModal portfolio" data-izimodal-title="Portfolio Title" data-izimodal-subtitle="Web Design" style="max-width: 1200px important;">
<div class="col_one_third p-20">
<?php
$args2 = array(
'post_type' => 'custom_portfolio',
'posts_per_page' => '6',
);
// the query
$query2 = new WP_Query( $args2 );
// The Loop
if ( $query2->have_posts() ) ?>
<?php while ( $query2->have_posts() ) :
$query2->the_post() ; ?>
<div class="col_half p-10">
<a href="#<?php the_ID(); ?>-<?= $globalID; ?>" data-toggle="tab">
<img src="<?php echo get_post_meta(get_the_ID(), 'portfolio_image', true); ?>" class="portfolio-thumb"/>
</a>
</div>
<?php endwhile; wp_reset_query(); ?>
<div class="col_full p-10">
<div class="portfolio-links">
Launch Website
Request a Quote
</div>
</div>
</div>
<div class="col_two_third col_last">
<div class="tab-content ">
<?php
$args3 = array(
'post_type' => 'custom_portfolio',
'posts_per_page' => '-1',
);
// the query
$query3 = new WP_Query( $args3 );
// The Loop
if ( $query3->have_posts() ) ?>
<?php while ( $query3->have_posts() ) :
$query3->the_post() ; ?>
<div class="tab-pane active" id="<?php the_ID(); ?>-<?= $globalID; ?>">
<img src="<?php echo get_post_meta($globalID, 'portfolio_image', true); ?>" class="img-responsive"/>
</div>
<?php endwhile; wp_reset_query(); ?>
</div>
</div>
</div>
<!-- Item End-->
<?php endwhile; wp_reset_query(); ?>
</div>
</section>
<section>
</section>
<div class="wave-divider-common"></div>
<?php get_footer(); ?>
Thanks for help...
Modify your html for first anchor tag as
<a class="trigger" data-iziModal-open="#modal<?php the_ID(); ?>" data-id="<?php the_ID(); ?>-<?= $globalID; ?>">
<img src="<?php echo get_post_meta(get_the_ID(), 'portfolio_image', true); ?>">
</a>
Add this JS
<script type="text/javascript">
$(document).ready(function(){
$('a.trigger').on('click', function (e) {
var getDataId = $(this).data('id');
$('.iziModal a[href="#' + getDataId + '"]').tab('show');
});
});
</script>
HMTL original rendered:
<div class="col-md-4">
<div class="row">
3 - Blog Post
</div>
<div class="row">
<img width="150" height="150" src="http://localhost/PHP/wordpress/wp-content/uploads/2017/04/imagem-principal-150x150.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="" srcset="http://localhost/PHP/wordpress/wp-content/uploads/2017/04/imagem-principal-150x150.jpg 150w, http://localhost/PHP/wordpress/wp-content/uploads/2017/04/imagem-principal-300x300.jpg 300w, http://localhost/PHP/wordpress/wp-content/uploads/2017/04/imagem-principal-768x768.jpg 768w, http://localhost/PHP/wordpress/wp-content/uploads/2017/04/imagem-principal.jpg 900w" sizes="(max-width: 150px) 100vw, 150px" />
</div>
</div>
HTML after setup_postdata( $post );
<div class="row">
<div class="col-md-4">
<div class="row">
<a href="http://localhost/PHP/wordpress/3-blog-post/">
3 - Blog Post </a>
</div>
<div class="row">
<img width="150" height="150" src="http://localhost/PHP/wordpress/wp-content/uploads/2017/04/imagem-principal-150x150.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="" srcset="http://localhost/PHP/wordpress/wp-content/uploads/2017/04/imagem-principal-150x150.jpg 150w, http://localhost/PHP/wordpress/wp-content/uploads/2017/04/imagem-principal-300x300.jpg 300w, http://localhost/PHP/wordpress/wp-content/uploads/2017/04/imagem-principal-768x768.jpg 768w, http://localhost/PHP/wordpress/wp-content/uploads/2017/04/imagem-principal.jpg 900w" sizes="(max-width: 150px) 100vw, 150px" />
Bem-vindo ao WordPress. Esse é o seu primeiro post. Edite-o ou exclua-o, e então comece a escrever!
</div>
</div>
Weird things:
The code:
<div class="container">
<div class="row">
<?php
$args = array( 'numberposts' => '3' );
$recent_posts = wp_get_recent_posts( $args );
foreach($recent_posts as $post)
{
?><div class="col-md-4">
<div class="row">
<a href="<?php echo get_the_permalink($post['ID']); ?>">
<?php echo $post['post_title']; ?>
</a>
</div>
<div class="row">
<?php echo get_the_post_thumbnail($post['ID'], 'thumbnail'); ?>
<?php
$my_excerpt = get_the_excerpt($post['ID']);
if ( '' != $my_excerpt ) {
// Some string manipulation performed
}
echo $my_excerpt // Outputs the processed value to the page
?>
</div>
</div><?php
}
wp_reset_query();
?>
</div>
</div>
</br>
</br>
<div class="container">
<div class="row">
<?php
$args = array( 'numberposts' => '3' );
$recent_posts = wp_get_recent_posts( $args );
foreach($recent_posts as $post) { ?>
<div class="col-md-4">
<div class="row">
<a href="<?php echo get_the_permalink($post['ID']) ?>">
<?php echo $post['post_title'] ?>
</a>
</div>
<div class="row">
<?php echo get_the_post_thumbnail($post['ID'], 'thumbnail'); ?>
</div>
<div class="row">
<?php
$my_excerpt = get_the_excerpt($post['ID']);
if ( '' != $my_excerpt ) {
// Some string manipulation performed
}
echo $my_excerpt // Outputs the processed value to the page
?>
</div>
</div>
<?php
}
wp_reset_query();
?>
</div>
</div>
When I change the position of the code and remove title and thumbnail, the code works well:
<?php
$args = array( 'numberposts' => '3' );
$recent_posts = wp_get_recent_posts( $args );
foreach($recent_posts as $post) { ?>
<?php
$my_excerpt = get_the_excerpt($post['ID']);
if ( '' != $my_excerpt ) {
// Some string manipulation performed
}
echo $my_excerpt // Outputs the processed value to the page
?>
</div>
</div>
<?php
}
wp_reset_query();
?>
I call the recent posts in my wordpress / woocommerce page, but when I call the excerpt, it didn't appear, title and thumbnail are ok. I have worked on it all day long, but I couldn't figure out what happen. When I change "echo $my_excerpt" with a simple word, it works. The problem should be when I put the content in a array. I had followed the documentation as you can see:
https://codex.wordpress.org/Function_Reference/get_the_excerpt
Examples
get_the_excerpt() can be used to retrieve and store the value in a variable, without outputting it to the page.
<?php
$my_excerpt = get_the_excerpt();
if ( '' != $my_excerpt ) {
// Some string manipulation performed
}
echo $my_excerpt; // Outputs the processed value to the page
?>
My code:
<?php
$args = array( 'numberposts' => '3' );
$recent_posts = wp_get_recent_posts( $args );
foreach($recent_posts as $post) { ?>
<div class="col-md-4">
<div class="row">
<a href="<?php echo get_permalink($post['ID']) ?>">
<?php echo $post['post_title'] ?>
</a>
</div>
<div class="row">
<?php echo get_the_post_thumbnail($post['ID'], 'thumbnail'); ?>
<?php
$my_excerpt = get_the_excerpt();
if ( '' != $my_excerpt ) {
// Some string manipulation performed
}
echo $my_excerpt // Outputs the processed value to the page
?>
</div>
</div>
<?php
}
wp_reset_query();
?>
</div>
</div>
Edit: I have altered your code try using this one.
<?php
$args = array( 'numberposts' => '3' );
$recent_posts = wp_get_recent_posts( $args );
foreach($recent_posts as $post)
{
setup_postdata( $post ); // Edit: This will force wordpress to setup the data
?><div class="col-md-4">
<div class="row">
<a href="<?php echo get_the_permalink($post['ID']); ?>">
<?php echo $post['post_title']; ?>
</a>
</div>
<div class="row">
<?php echo get_the_post_thumbnail($post['ID'], 'thumbnail'); ?>
<?php
$my_excerpt = get_the_excerpt($post['ID']);
if ( '' != $my_excerpt ) {
// Some string manipulation performed
}
echo $my_excerpt // Outputs the processed value to the page
?>
</div>
</div><?php
}
wp_reset_query();
?>
Try this. I have provided post id to your get the excerpt.
<?php
$my_excerpt = get_the_excerpt($post['ID']);
if ( '' != $my_excerpt ) {
// Some string manipulation performed
}
echo $my_excerpt // Outputs the processed value to the page
?>
Well, after a plenty of options, tests, feedbacks and research, I've found a way to make it.
Thank you everyone!
My final code:
<!-- Testando novo formato -->
<p class="display-4" style="text-align:center">Testando - Posts Recentes</p>
<div class="container">
<div class="row">
<?php
query_posts( array('posts_per_page'=>3) );
while ( have_posts() ) : the_post();
?>
<div class="col-md-4">
<div class="card" style="width: 20rem; margin-bottom:3rem; margin-top:3rem;">
<img class="card-img-top img-fluid" src="<?php the_post_thumbnail(); ?>">
<div class="card-block">
<h4 class="card-title"><?php the_title(); ?></h4>
<p class="card-text">
<?php
the_excerpt();
?>
</p>
<a class="btn btn-primary" href="<?php the_permalink(' ') ?>">Ler o post</a>
</div>
</div>
</div>
<?php
endwhile;
wp_reset_query(); // resets main query
?>
</div>
</div>
I have two loop with orderby random(all work good), but I want to show same post for each loop,
example: I have post 1 to 10;
loop 1 show post 1 2 and 3;
loop 2 need to show same post 1 2 and 3, my code is:
<div class="col-md-12" data-wow-delay="0.2s">
<div class="carousel slide" data-ride="carousel" id="quote-carousel">
<!-- Bottom Carousel Indicators -->
<ol class="carousel-indicators">
<?php
$args = array(
'post_type' => 'testimonials',
'orderby' => 'rand',
'posts_per_page' => 3 );
$loop = new WP_Query( $args );
$i = 0;
while ( $loop->have_posts() ) : $loop->the_post();
$avatar_testimonials = get_field('avatar-testimonials');
?>
<li data-target="#quote-carousel" data-slide-to="<?php echo $i; ?>" class="<?php if ($i == 0) echo 'active'; ?>"><img class="img-responsive" alt="<?php echo the_title(); ?>" src="<?php if ($avatar_testimonials) {echo $avatar_testimonials['url'];} else {the_post_thumbnail_url('thumbnail');} ?>" alt=""></li>
<?php $i++; endwhile; ?>
</ol>
<!-- Carousel Slides / Quotes -->
<div class="carousel-inner text-center">
<?php
$args = array(
'post_type' => 'testimonials',
'orderby' => 'rand',
'posts_per_page' => 3 );
$loop = new WP_Query( $args );
$i = 0;
while ( $loop->have_posts() ) : $loop->the_post();
?>
<!-- Quote 1 -->
<div class="item <?php if ($i == 0) echo 'active'; ?>">
<blockquote>
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<?php echo the_excerpt(); ?>
<small><?php echo the_title(); ?></small>
</div>
</div>
</blockquote>
</div>
<?php $i++; endwhile; wp_reset_postdata(); ?>
</div>
</div>
</div>
Try this, I think it will work for you.
<div class="col-md-12" data-wow-delay="0.2s">
<div class="carousel slide" data-ride="carousel" id="quote-carousel">
<!-- Bottom Carousel Indicators -->
<ol class="carousel-indicators">
<?php
$args = array(
'post_type' => 'testimonials',
'orderby' => 'rand',
'posts_per_page' => 3 );
$loop = new WP_Query( $args );
$i = 0;
while ( $loop->have_posts() ) : $loop->the_post();
$avatar_testimonials = get_field('avatar-testimonials');
?>
<li data-target="#quote-carousel" data-slide-to="<?php echo $i; ?>" class="<?php if ($i == 0) echo 'active'; ?>"><img class="img-responsive" alt="<?php echo the_title(); ?>" src="<?php if ($avatar_testimonials) {echo $avatar_testimonials['url'];} else {the_post_thumbnail_url('thumbnail');} ?>" alt=""></li>
<?php $i++; endwhile; ?>
</ol>
<!-- Carousel Slides / Quotes -->
<div class="carousel-inner text-center">
<?php
$i = 0;
while ( $loop->have_posts() ) : $loop->the_post();
?>
<!-- Quote 1 -->
<div class="item <?php if ($i == 0) echo 'active'; ?>">
<blockquote>
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<?php echo the_excerpt(); ?>
<small><?php echo the_title(); ?></small>
</div>
</div>
</blockquote>
</div>
<?php $i++; endwhile; wp_reset_postdata(); ?>
</div>
</div>
</div>
I want to show 5 posts, first one is bigger and has a other class around itself.
I've found a few other posts which are basically the same, but none of them shows how to 'wrap' the first post and 'wrap' all the other posts together.
I've made an example with html/css how it should look.
Hope someone can help me with this. :)
<?php
$args = array(
'post_type' => 'services',
'posts_per_page' => 5
);
$loop = new WP_Query($args);
while ($loop->have_posts()) :
$loop->the_post();
if ($loop->current_post == 0) {
echo '<div class="col-md-6">';
the_post_thumbnail();
the_title();
echo '</div>';
}
else {
echo '<div class="col-md-6">';
the_post_thumbnail();
the_title();
echo '</div>';
}
endwhile; wp_reset_postdata(); ?>
.col-md-6 {
width: 50%;
padding: 0 !important;
float: left;
}
img {
width: 100%;
height: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<section>
<div class="col-md-6">
<img src="http://placehold.it/100x100" alt="">
</div>
<div class="col-md-6">
<div class="col-md-6"><img src="http://placehold.it/100x100" alt=""></div>
<div class="col-md-6"><img src="http://placehold.it/100x100" alt=""></div>
<div class="col-md-6"><img src="http://placehold.it/100x100" alt=""></div>
<div class="col-md-6"><img src="http://placehold.it/100x100" alt=""></div>
</div>
</section>
<?php
$args = array(
'post_type' => 'services',
'posts_per_page' => 5
);
$loop = new WP_Query($args);
while ($loop->have_posts()) :
$loop->the_post();
echo '<div class="some-div">';
if ($loop->current_post == 0) {
echo '<div class="col-md-6">';
the_post_thumbnail();
the_title();
echo '</div>';
echo '</div>'; // close .some-div
echo '<div class="other-div">';
}
else {
echo '<div class="col-md-6">';
the_post_thumbnail();
the_title();
echo '</div>';
}
echo '</div>'; // close .other-div
endwhile; wp_reset_postdata(); ?>
I've fixed this the way I want.
Here's the code I've uesd if someone's looking for something like this.
<section class="no-gutter">
<?php
$args = array(
'post_type' => 'services',
'posts_per_page' => 5
);
$loop = new WP_Query($args);
while ($loop->have_posts()) :
$loop->the_post(); ?>
<?php if ($loop->current_post == 0) : ?>
<!-- large -->
<div class="col-md-6 large">
<a href="<?php the_permalink(); ?>" title="<?php the_title();?>">
<div class="wrapper">
<?php the_post_thumbnail(); ?>
<span><?php the_title(); ?></span>
</div>
</a>
</div><!-- end large -->
<!-- small -->
<div class="col-md-6">
<?php else : ?>
<div class="col-md-6">
<a href="<?php the_permalink(); ?>" title="<?php the_title();?>">
<div class="wrapper">
<?php the_post_thumbnail(); ?>
<span><?php the_title(); ?></span>
</div>
</a>
</div>
<?php endif; ?>
<?php endwhile; wp_reset_postdata(); ?>
</div><!-- end small -->