WordPress.org

Forums

Hatch
[resolved] Custom post type in loop (2 posts)

  1. Stacy (non coder)
    Member
    Posted 1 year ago #

    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.

  2. Stacy (non coder)
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic