Support » Theme: Hatch » Custom post type in loop

  • Resolved Stacy (non coder)


    Tried adding $query = new WP_Query( ‘post_type=products’ );
    in themefunctions and add_filter( ‘pre_get_posts’, ‘my_get_posts’ );
    function my_get_posts( $query ) {
    if ( is_home() && $query->is_main_query())
    $query->set( ‘post_type’, array( ‘post’,’product’ ) );
    return $query;

    Still not showing the product post type.

    This is a beautiful theme for any type of site. Thanks.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom post type in loop’ is closed to new replies.