Hi Tom
I’ve been browsing through the forum but can’t work out exactly what I need to do. I’m afraid I’m a bit of a newbie!
One of your replies has the below code for putting specific categories of post on the home page. I’ve activated the Code Snippets plugin and my category name is Company Updates. I’d like to put these categories of posts in my footer widget 4 on my home page which is set to show recent posts. Is there a way to code this? Alternatively is there a post plugin which would work well with the footer widget? Ideally, I’d like to be able to specify post numbers or sticky posts but categories could be a workaround.
Thank you so much.
function generate_home_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( ‘category_name’, ‘home-category-slug’ );
}
}
add_action( ‘pre_get_posts’, ‘generate_home_category’ );
My version:
function generate_home_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( ‘Company Updates’, ‘company-updates’ );
}
}
add_action( ‘pre_get_posts’, ‘generate_home_category’ );