WordPress.org

Support

Support » Themes and Templates » Pinboard » [Resolved] Audio Formats – default featured image

[Resolved] Audio Formats – default featured image

  • Is it possible to setup a featured image for a specific post format.

    I noticed there are post formats for Quotes for example that has a nice quote icon/image.

    I use my own audio player and want to assign my over 2000 custom post type (audio) posts with Audio post format but it should then have a defaulted featured image.

    Is is possible? If so, any guidance would be great.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Figured it out.

    Step 1: Make all the custom posts of post format = Audio
    Step 2: Add this function to a child theme function.php and voila.

    function pinboard_post_thumbnail() {
    	if( has_post_thumbnail() ) { ?>
    		<figure class="entry-thumbnail">
    			<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
    				<?php the_post_thumbnail( ( pinboard_is_teaser() ? 'teaser-thumb' : 'blog-thumb' ) ); ?>
    			</a>
    		</figure>
    	<?php
    	}
    	else
    	{
    		global $post;
    		$format = get_post_format( $post->ID );
    
    		if ($format == 'audio')
    		{
    		?>
    			<figure class="entry-thumbnail">
    		<?php
    		echo '<br>';
    		?>
    		<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
    		<?php
    		echo '<img src="http://files.muslimcentralmedia.com/images/post-icons/audios_icon.png" width="50px" height="50px" alt="' .the_title( ' ', '',false) . '" /> </a>';
    		?>
    
    		</a>
    		</figure>
    		<?php
    		}
    	}
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Audio Formats – default featured image’ is closed to new replies.
Skip to toolbar