2014-09-17 3 views
0

Я работаю на преобразование Wordpress Двадцать Десять темы загрузчикПреобразование Wordpress Twenty Ten темы для начальной загрузки

Вот код в index.php отображается

<div class="col-md-3"> 
    <a href="<?php the_permalink(); ?>"><?php if (function_exists("has_post_thumbnail") && has_post_thumbnail()) { the_post_thumbnail(array(200,160), array("class" => "img-responsive img-thumbnail home-thumb")); } ?></a> 
</div> 

<div class="col-md-9"> 
    <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr(sprintf(__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0'))); ?>" rel="bookmark"><?php the_title(); ?></a></h2> 
    <?php the_excerpt(); ?> 
</div><!-- .col-md-9--> 

Но пустое пространство, если мы не есть изображение в нашем посте.

Вот скриншот: http://imgur.com/HxYdnFc

Как использовать 'COL-MD-12' вместо 'COL-MD-9', если у нас нет миниатюру?

ответ

1
<div class="col-md-3"> 
<a href="<?php the_permalink(); ?>"><?php if (function_exists("has_post_thumbnail") && has_post_thumbnail()) { the_post_thumbnail(array(200,160), array("class" => "img-responsive img-thumbnail home-thumb")); } ?></a> 
</div> 

<div class="<?php echo (has_post_thumbnail())?'col-md-9':'col-md-12'?>"> 
    <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr(sprintf(__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0'))); ?>" rel="bookmark"><?php the_title(); ?></a></h2> 
    <?php the_excerpt(); ?> 
</div><!-- .col-md-9-- 
+0

О ,,, Большое спасибо ... Спасибо – user3312708

Смежные вопросы