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*

Set Blog Image Medium for a particular category

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #45987
    cecilia
    Participant

    Hi, I want to show only posts from my category “NEWS”, can you help me to filter that category into the code?
    Thanks!

    #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

    #46230
    cecilia
    Participant

    Thank you, but actually what I wanted was to filter the query in template medium so it shows only the “news” category.

    #46310

    Hi cecilia,

    If you want to display only that category(“News”) then goto dashboard -> appearance -> customize -> Advance Options -> Home Page blog category settings

    Selecting category will only be displayed on home/ front page.

    Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.