我创建了以下一个新的帖子元框:
// Big Artful Interiors Post Meta Box
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Big Artful Interiors',
'id' => 'big-artful-interiors',
'post_type' => 'post'
)
);
}
我想以全尺寸显示这个新的特色图片来代替我的网站主页本节 -> http://nimb.ws/PFxVej第一个特色图片。
现在,在主题 front-page.php 文件中使用以下代码显示帖子特色图像。
<?php
$artful_int_options = array('artful_int_1', 'artful_int_2', 'artful_int_3');
$artful_ints = array();
foreach ( $artful_int_options as $artful_int_option ) {
if ( !empty( ot_get_option( $artful_int_option ) ) ) {
$artful_ints[] = ot_get_option( $artful_int_option );
}
}
if ( !empty( $artful_ints ) ) {
$args_art_ints = array('post__in'=>$artful_ints,'posts_per_page'=>3,'orderby'=>'post__in');
$query_art_ints = new WP_Query($args_art_ints);
if ($query_art_ints->have_posts()) {
?>
<div id="artful_interiors">
<h2>Artful Interiors</h2>
<div class="subheading">By Luxury Home and Design Show</div>
<div class="row" data-equal=">.columns">
<div class="columns small-12 medium-9">
<div class="row">
<?php while ( $query_art_ints->have_posts() ) : $query_art_ints->the_post(); ?>
<div class="small-12 large-12 columns post">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail('thevoux-single',array('itemprop'=>'image')); ?>
</a>
<div class="featured-title">
<?php if( has_category() ) { ?>
<aside class="post-meta cf">
<?php the_category(', '); ?>
</aside>
<?php } ?>
<div class="row">
<div class="columns medium-10">
<div class="post-title">
<a href="<?php the_permalink(); ?>"><?php the_title() ?></a>
</div>
</div>
<div class="columns medium-2">
<figure class="post-gallery <?php do_action('thb_is_gallery'); ?>"></figure>
</div>
</div>
</div>
</div>
<?php break; endwhile; ?>
</div>
<div class="row posts">
<?php while ( $query_art_ints->have_posts() ) : $query_art_ints->the_post(); ?>
<div class="small-12 large-6 columns">
<?php
set_query_var( 'disable_excerpts', 'true' );
set_query_var( 'disable_author', 'true' );
get_template_part( 'inc/templates/loop/style6' );
?>
</div>
<?php endwhile; ?>
</div>
</div>
<div id="second_q_block" class="columns medium-3 small-12 q_block">
<div class="sidebar-inner fixed-me">
<?php tol_ad('front_artful_interiors') ?>
</div>
</div>
</div>
</div>
<?php
wp_reset_postdata();
}
} ?>
我已遵循插件说明https://github.com/voceconnect/multi-post-thumbnails/wiki但这在我的 front-page.php 文件中不起作用。
关于如何显示此自定义特色图像的任何想法?
谢谢。