Support » Theme: Encounters Lite » Display articles on blog post page

  • Resolved swjack14

    (@swjack14)


    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’ );’

Viewing 1 replies (of 1 total)
  • Theme Author Styled Themes

    (@gejay)

    Hi swjack14,

    The code given above should be palced on functinos.php file. It seems you want to display articles instead of post so you need to keep search condition. Here is the link :
    https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts on this same post you can see Include

    Custom Post Types in Search Results

    this section that may help you.

    If you got any queries regarding to our theme setting,please do consult us. We will be more than happy to assist you.

Viewing 1 replies (of 1 total)
  • The topic ‘Display articles on blog post page’ is closed to new replies.