Community Forums › Forums › Archived Forums › Design Tips and Tricks › Excluding Category in Featured Post
- This topic has 4 replies, 4 voices, and was last updated 11 years, 9 months ago by
Tom.
-
AuthorPosts
-
June 5, 2014 at 2:30 pm #108208
Michael_S
ParticipantI'm using Modern Portfolio Pro and am wondering if it is possible to exclude a specific Post category from appearing in the Home>Blog widget area of my home page yet still appear in the Home>Portfolio widget area.
The "Featured Post" widget is used for both.
I'm sensing this is a "you can't have it both ways" circumstance.
This bit of php posted a year ago by Brad Dalton looked promising, but I was unable to get it to work:
d_action( 'pre_get_posts', 'exclude_category_posts_home' );
function exclude_category_posts_home( $query ) {
if( $query->is_main_query() && $query->is_home() ) {
$query->set( 'cat', '-32' );
}(substituting "portfolio" for "category" and used Cat ID "8")
I'd appreciate some insight. Perhaps pair-up a Text Widget and a dash of php?
Thanks
Mike
http://www.test.puebloperiodically.com/June 5, 2014 at 2:34 pm #108210mpet29
MemberI needed to do the same thing on a previous site, and also ran into your issue. What I did to get around it was to make that category a custom post type, which kept it out of the main feed, and then I had a widget that was set to ONLY show that post type.
June 5, 2014 at 2:40 pm #108214Kyle Rumble
MemberI've never used the theme before, but if its a blog category you should only have to change the cat id.
$query->set( ‘cat’, ‘-8′ );Or maybe try this plugin: https://wordpress.org/plugins/flexible-posts-widget/ you can filter by CPT, Taxonomy/Cat, and even Post ID's.
June 6, 2014 at 6:10 am #108301Michael_S
ParticipantThanks, gentlemen. I'm gonna poke around some more and see what I can come up with; I appreciate your suggestions.
Mike
June 7, 2014 at 12:57 am #108431Tom
Participantexclude a specific Post category from appearing in the Home>Blog widget area of my home page yet still appear in the Home>Portfolio widget area.
You can do this with a plugin to control the post output by category in the Home Blog widget area. Try using Genesis Sandbox Featured Content Widget -- you will have do use a slightly older version (1.1.3 vs 1.1.4) as the current version ability to select (include) a single category is broken. Get 1.1.3 >here<.
Once loaded and activated, use this plugin to output blog posts (Taxonomy and Terms: All Taxonomy and Terms), but exclude the post category/categories by specifying their category ID(s) in "Exclude Terms by ID (comma separated list)". Specify other characterstics as desired for image, title, excerpt, etc.
Your portfolio section can stay as-is or use GSFC widget to control output there, too.

Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ] -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.