WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Originalas
    Member
    Posted 7 months 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>'; ?>

    http://wordpress.org/plugins/dynamic-featured-image/

  2. Originalas
    Member
    Posted 7 months 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(); ?>">

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.