如果Single.php上存在滑块,则删除特征图像
下面的代码是针对我的single.php的。php if(have_posts())调用标准wordpress功能图像,函数_exists('dfi_get_featured_images')部分获取以nivo滑块样式包装的滑块图像 php if(have_posts())循环正在破坏脚本。我试图将其包含在if-else语句中,以仅在帖子if($featuredImages!=NULL)中没有幻灯片图像时显示wordpress特色图像 任何关于编码的帮助都会很好 谢谢…李如果Single.php上存在滑块,则删除特征图像,php,wordpress,image,featured,Php,Wordpress,Image,Featured,下面的代码是针对我的single.php的。php if(have_posts())调用标准wordpress功能图像,函数_exists('dfi_get_featured_images')部分获取以nivo滑块样式包装的滑块图像 php if(have_posts())循环正在破坏脚本。我试图将其包含在if-else语句中,以仅在帖子if($featuredImages!=NULL)中没有幻灯片图像时显示wordpress特色图像 任何关于编码的帮助都会很好 谢谢…李 <div id=
<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 ?>
}
?>
因此,您将首先检查插件,然后检查是否存在插件图像,如果其中任何一个图像为负片,您将显示缩略图图像。工作正常!谢谢Ceili。
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
if ( function_exists('dfi_get_featured_images') ) { // If the featured images function exists
$featuredImages = dfi_get_featured_images(); // Get those featured slider images
if( !is_null($featuredImages) ) { //If there are featured slider images to get, then:
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>";
} else {
the_post_thumbnail( 'full' );
}
} else if ( has_post_thumbnail() ) { //If there are no featured images to get, but there is a thumbnail
the_post_thumbnail( 'full' );
} // end else if
} // end while
} // end hav_posts
?>
if (has function check if dfi images is registered) {
check and see if there are andy dfi images
if there are dfi images {
loop through them and display them
} else if dfi images is registered but there are no dfi images {
display the thumbnail
}
} else, dfi images must not be registered {
display the thumbnail
}