• Resolved MCM

    (@nathmie)


    Crazy question is it possible to update X amount of posts with a image/featured image.

    i.e. I have a number of posts from a specific category for which I have no image.

    I would like to use the same image for all the psots in that category either as a featured image OR place the html code at the top of the page to point to a image I have stored.

    Is this possible at all?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I would do something like this…

    $has_featured = has_post_thumbnail(55);
    if ( in_category(3) && !$has_featured ) { echo "<img ... "; }

    That way it will check for the category and that it doesn’t already have a featured image set.

    Something along those lines should work.

    Thread Starter MCM

    (@nathmie)

    Where would I place that? functions.php?

    Yes, you are correct.

    Thread Starter MCM

    (@nathmie)

    It works, code slightly modified to get it to work…

    <?php
    	$has_featured = has_post_thumbnail(55);
    	if ( !$has_featured )
    	{
    	echo '<img src="logo.png" alt="my text" />';
    	}
    	?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Mass Updating Posts with a set Image’ is closed to new replies.