Dynamic Featured Image
[resolved] Replace default the_post_thumbnail() with dynamic featured image (2 posts)

  1. Originalas
    Posted 2 years ago #

    My theme uses function the_post_thumbnail('featured',array('title' => '')); to display featured images in post loop. I would like to replace it with Dynamic image function, so I could display images from remote url.

    What code do I need to replace the_post_thumbnail() with dynamic featured image function?
    IMO, it would be great feature for later plugin versions to have alternative for default WP the_post_thumbnail() :)

    Here is my theme post loop code.

    <?php  $j=0; $i =0; if (have_posts()) : while (have_posts()) : the_post(); ?>
    				<article class="<?php echo 'pexcerpt'.$i++?> post excerpt <?php echo (++$j % 2 == 0) ? 'last' : ''; ?>">
    					<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail">
    						<?php if ( has_post_thumbnail() ) { ?>
    							<?php echo '<div class="featured-thumbnail">'; the_post_thumbnail('featured',array('title' => '')); echo '</div>'; ?>


  2. Originalas
    Posted 2 years ago #

    Solved this by using custom field, since I needed only remote url to image. :)

    <img src="<?php $feat=get_post_meta(get_the_ID(), 'featured_url', true); if($feat){echo $feat;} else {echo get_template_directory_uri(), '/images/nothumb.png'; } ?>" class="attachment-featured wp-post-image" alt="<?php the_title(); ?>">

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Dynamic Featured Image
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.