Forums Forums Search & Filter Pro Search Field Showing Categories for CPT, Showing Categories as Empty (0)

Viewing 10 posts - 1 through 10 (of 13 total)
  • Anonymous
    #269098

    Hi,

    I’m using SFP to filter a number of local shops by what they offer as far as online services. The custom post type is “ecommguide” and there are a number of categories. The category titles show properly in the search form but show as empty or no posts. FYI there are about 130 posts divided among the categories.

    Here is the page:
    http://brandonchamber.ca/shop-local/

    I’m using short codes on the same page using the WP rich text editor.

    I add my custom post types to the functions file. Here is the cpt code in case I’ve missed a detail (I keep them pretty simple):

    function include_custom_post_types( $query ) { global $wp_query;
    if ( is_category() || is_tag() ) {
    $post_types = get_post_types();
    $custom_post_type = get_query_var( ‘post_type’ );
    if ( empty( $custom_post_type ) ) $query->set( ‘post_type’ , $post_types );
    }
    return $query;
    }
    add_filter( ‘pre_get_posts’ , ‘include_custom_post_types’ );

    add_action( ‘init’, ‘create_post_type’ );
    function create_post_type() {

    register_post_type( ‘ecommguide’,
    array(
    ‘labels’ => array(
    ‘name’ => __( ‘Ecomm Guide’ ),
    ‘singular_name’ => __( ‘Ecomm Guide’ ),
    ‘taxonomies’ => array(‘category’),
    ),
    ‘public’ => true,
    ‘has_archive’ => true,
    ‘exclude_from_search’ => false,
    ‘supports’ => array( ‘title’, ‘editor’, ‘revisions’),
    ‘taxonomies’ => array(‘category’),
    )
    );

    }

    Thanks!
    Scott

    Trevor
    #269119
    This reply has been marked as private.
    Anonymous
    #269121

    Hi!

    OK – I’ve already gotten closer… by unchecking “Enable Auto Count” I now have the number of posts per category showing (e.g. Food & Beverage (14)) but now I am returning no results on the form. I have also simplified my form to remove extra chances of simply creating a form incorrectly.

    Criteria I’m using:

    Post type to search: Ecomm Guide
    Results per page: 150
    Auto submit form? checked (I’ve tried using just a submit button, but same result)
    Field relationships: AND
    Enable Auto Count: not enabled
    Update the Search Form on user interaction: checked

    Anonymous
    #269123
    This reply has been marked as private.
    Trevor
    #269146
    This reply has been marked as private.
    Anonymous
    #269148
    This reply has been marked as private.
    Trevor
    #269151

    Did you see my last message?

    Anonymous
    #269157
    This reply has been marked as private.
    Anonymous
    #269163

    I’m not trying to apply the categories created for the custom post type to other post types. Are you suggesting limiting the categories to the custom post type? How do I do that?

    Trevor
    #269165
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 13 total)