Display articles on blog post page
-
I am using IssueM plugin to create magazine articles. Their suggested code addition to functions.php breaks themes. While waiting for them to offer a different suggestion, can you help me on how to do this? I am using a static home page. For the blog page I want to search not for posts but for articles. Do you know how this can be done?
Here’s what they suggested. Maybe it would work if placed in the proper place. Yes, I realize a child theme would be the way to do this so as to preserve the modification after theme updates.
‘function add_articles_to_homepage( $query ) {
if ( !is_admin() && is_home() && $query->is_main_query() ) {
$query->set( ‘post_type’, array( ‘post’, ‘article’) );
}
return $query;
}
add_action( ‘pre_get_posts’, ‘add_articles_to_homepage’ );’
- The topic ‘Display articles on blog post page’ is closed to new replies.