WordPress.org

Ready to get started?Download WordPress

Forums

Pinboard
[resolved] Audio Formats - default featured image (3 posts)

  1. MCM
    Member
    Posted 1 year ago #

    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.

  2. MCM
    Member
    Posted 1 year ago #

    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.

  3. MCM
    Member
    Posted 1 year ago #

    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
    		}
    	}
    }

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.