badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Reply To: Set Blog Image Medium for a particular category

#46009

Hi cecilia,
Goto dashboard -> appearance -> customize -> advanced options -> home page/ blog category settings and select your news category to display only posts from your news category.

Our default is blog image large. So blog image medium template will not work for it. It needs some code customziation on the default theme layout from blog image large to blog image medium. Go to theme folder -> inc -> structure -> content-extensio.php on line no 132 to 141 you will find below code

    <?php
			if( has_post_thumbnail() ) {
				$image = '';        			
	     		$title_attribute = the_title_attribute( array( 'echo' => false ) );
	     		$image .= '<figure class="post-featured-image">';
	  			$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
	  			$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
	  			$image .= '</figure><!-- .post-featured-image -->';
	  			echo $image;
  		} ?>

replace with

    <?php
			if( has_post_thumbnail() ) {
				$image = '';        			
	     		$title_attribute = the_title_attribute( array( 'echo' => false ) );
	     		$image .= '<figure class="post-featured-image">';
	  			$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
	  			$image .= get_the_post_thumbnail( $post->ID, 'featured-medium', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
	  			$image .= '</figure><!-- .post-featured-image -->';
	  			echo $image;
  		} ?>

We recommended not to change the code because if you change the code then while updating to our new version all your customisation code will be lost. So better make child theme and first unhook the functions and the edit the code.

http://codex.wordpress.org/Child_Themes

Thank you