WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Stacy (non coder)
    Member
    Posted 7 months 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 7 months ago #

Reply

You must log in to post.

About this Theme

About this Topic