• Resolved nengard

    (@nengard)


    I have a function in my theme that looks for the featured image or shows the default image. What I’d like to do is add an “else if” in there to say that if this post has a title that starts with ‘Bookmarks for’ I’d like to use a different image than the default. These posts are posted automatically and won’t have a featured image so that’s why I need to add it to the code. Any tips on altering this to do what I want?

    if ( has_post_thumbnail() ) {
    	 the_post_thumbnail( 'vulc_post', array('class' => 'postimg') );
    } else {
    ?>
    <img class="postimg" src="<?php bloginfo('template_directory'); ?>/images/dummy.png"  />
    <?php
    };
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Choose featured image based on title’ is closed to new replies.