iTheme2把文章特色图片放在标题下面的方法

本文共被喵星人侦察过6,757次。。。

今天早上收到站长噜噜猪同学的求助,大概的意思就是他的站点用得旧版本的iTheme2主题,这一版本中文章的特色图片是显示在标题下面的,像这样:

Before

而新版的则会把特色图像显示在标题的上面。噜噜猪表示这个不好看。。。看有木有什么解决方法。稍稍研究主题代码后,发现很简单么。嘿嘿。

启用了iTheme2主题后,点击WordPress后台的外观>>编辑,然后编辑loop.php文件。把最前面的这一大堆代码往下挪动一下就好了。


<?php themify_post_before(); //hook ?>
<div id="post-<?php the_ID(); ?>" <?php post_class("post clearfix " . $themify->get_categories_as_classes(get_the_ID())); ?>>
 <?php themify_post_start(); //hook ?>

 <?php
 if( $post_image = themify_get_image($themify->auto_featured_image . $themify->image_setting . "w=".$themify->width."&h=".$themify->height) ){
 if($themify->hide_image != 'yes'): ?>
 <?php themify_before_post_image(); // Hook ?>
 <div class="post-image <?php echo $themify->image_align; ?>">
 <?php if( 'yes' == $themify->unlink_image): ?>
 <?php echo $post_image; ?>
 <?php else: ?>
 <a href="<?php echo themify_get_featured_image_link(); ?>"><?php echo $post_image; ?><?php themify_zoom_icon(); ?></a>
 <?php endif; ?>
 </div>
 <?php themify_after_post_image(); // Hook ?>
 <?php endif; //post image
 } ?>

把上面的一段代码移动到这段代码后面


<div class="post-content">
 <?php if($themify->hide_date != "yes"): ?>
 <p class="post-date">
 <span class="month"><?php the_time('M') ?></span>
 <span class="day"><?php the_time('j') ?></span>
 <span class="year"><?php the_time('Y') ?></span>
 </p>
 <?php endif; ?>

 <?php if($themify->hide_title != "yes"): ?>
 <?php themify_before_post_title(); // Hook ?>
 <?php if(is_single()): ?>
 <?php if($themify->unlink_title == "yes"): ?>
 <h1 class="post-title"><?php the_title(); ?></h1>
 <?php else: ?>
 <h1 class="post-title"><a href="<?php echo themify_get_featured_image_link(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
 <?php endif; //unlink post title ?>
 <?php else: ?>
 <?php if($themify->unlink_title == "yes"): ?>
 <h2 class="post-title"><?php the_title(); ?></h2>
 <?php else: ?>
 <h2 class="post-title"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
 <?php endif; //unlink post title ?>
 <?php themify_after_post_title(); // Hook ?>
 <?php endif; ?>

<?php endif; ?>

然后点下面的更新文件,搞定~嘿嘿。