Tagged: category posts
- This topic has 3 replies, 2 voices, and was last updated 8 years, 4 months ago by Theme Horse Support Team.
-
AuthorPosts
-
July 15, 2016 at 7:04 pm #45987ceciliaParticipant
Hi, I want to show only posts from my category “NEWS”, can you help me to filter that category into the code?
Thanks!July 18, 2016 at 10:26 am #46009Theme Horse Support TeamKeymasterHi 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
July 30, 2016 at 5:08 am #46230ceciliaParticipantThank you, but actually what I wanted was to filter the query in template medium so it shows only the “news” category.
August 4, 2016 at 7:13 am #46310Theme Horse Support TeamKeymasterHi 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!
-
AuthorPosts
- You must be logged in to reply to this topic.