WordPress.org

Support

Support » Plugins and Hacks » Custom Post Type UI » [Resolved] Archive for category of custom post type

[Resolved] Archive for category of custom post type

  • Hello, I’m new to custom post types and to this plugin. I have created a “work” custom post type for my client, and two child categories, brands and digital. Note that I also created a “work” parent category in the categories section of the plugin. I am trying to learn how to call the children of the brands and digital categories.

    Here’s the main work page: http://katherinearline.com/bolton/work/

    You’ll see the two links to the child categories, which both contain posts. However, when you click them, you are taken to the default archive.php template, which does not lost content from the category. I have an archive-work.php file and the main work page is correctly using it.

    I have this code in my functions.php file: `function any_ptype_on_cat($request) {
    if ( isset($request[‘category_name’]) )
    $request[‘post_type’] = ‘any’;

    return $request;
    }
    add_filter(‘request’, ‘any_ptype_on_cat’);

    function namespace_add_custom_types( $query ) {
    if( is_category() || is_tag() && empty( $query->query_vars[‘suppress_filters’] ) ) {
    $query->set( ‘post_type’, array(
    ‘post’, ‘work’
    ));
    return $query;
    }
    }
    add_filter( ‘pre_get_posts’, ‘namespace_add_custom_types’ );`

    Thank you for any help you can provide.

    Kate

    http://wordpress.org/plugins/custom-post-type-ui/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Michael Beckwith

    @tw2113

    Sorry, but I’m not quite understanding what the specific question is or the specific issue that you need help solving.

    I have child categories under my custom post type “work”. How do I access their archives?

    Plugin Author Michael Beckwith

    @tw2113

    wouldn’t it be /post-type/parent-cat/child-cat/ ?

    I would assume so, and tried that both with and without the two sub-categories being nested under a category named “work” (in addition to the post-type), but no entries are returned. Instead, http://katherinearline.com/bolton/work/brands/ returns just the first project in that category.

    Thanks for your help.

    Any thoughts on this item? Thanks!

    Plugin Author Michael Beckwith

    @tw2113

    Not really, sorry. I haven’t done a huge amount of work with parent/child categories really. It’s also more a general usage question than about our UI plugin itself.

    Hopefully someone else may have a better answer than I.

    Thanks. I checked my template structure by testing the site with the Twenty Thirteen theme, and these category links do not work correctly there either, so it’s something either with the post type or with the way I am trying to call the archive.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Archive for category of custom post type’ is closed to new replies.
Skip to toolbar