以下のコードは、私の single.php 用です。PHP の if ( have_posts() ) は標準のワードプレス機能イメージを呼び出し、 function_exists('dfi_get_featured_images') セクションは nivo-slider スタイルでラップされたスライダー イメージを取得します。
php if ( have_posts() ) ループがスクリプトを壊しています。if($featuredImages!=NULL) 投稿にスライド画像がない場合にのみワードプレスのおすすめ画像を表示する if else ステートメントに含めようとしました。
コーディングに関するヘルプは素晴らしいでしょう。
ありがとう...リー
<div id="featured" class="row-fluid">
<?php
if ( function_exists('dfi_get_featured_images') ) {
$featuredImages = dfi_get_featured_images();
if( !is_null($featuredImages) ){
echo "<div class='slider-wrapper theme-default'>";
echo "<div class='entry-thumbnail nivoSlider' style='width: 1170px;'>";
foreach($featuredImages as $images) {
echo "<a href='" . get_permalink() . "' title = '" . dfi_get_image_alt_by_id($images['attachment_id']) . "'>";
echo "<img src = '" . $images['thumb'] . "' />";
echo "</a>";
}
echo "</div>";
echo "</div>";
}
}
if($featuredImages!=NULL)
{
}
else
{
<?php if ( have_posts() ) { ?>
<?php while ( have_posts() ) { ?>
<?php the_post(); ?>
<?php if ( '' != get_the_post_thumbnail() ) { ?>
<?php the_post_thumbnail( 'full' ); ?>
<?php } // end if ?>
<?php } // end while ?>
<?php } // end have_posts ?>
}
?>