<?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
?>
A few things to note:
You don't have to keep opening and closing your php at the beginning and ending of every line. It makes the code cluttered much harder to read.
Think about what you're actually trying to do. You don't want to delete the featured image if there is a slider instead -- you want to show the slider instead of the featured image (at least, that's what it sounds like to me). Here is the thought process behind this code:
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
}
So you will first check for the plugin, then the presence of plugin images, and if either of those comes back negative you will display the thumbnail image.