WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type UI
[resolved] Archive for category of custom post type (8 posts)

  1. paumanok
    Member
    Posted 11 months ago #

    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/

  2. Michael Beckwith
    Member
    Plugin Author

    Posted 11 months ago #

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

  3. paumanok
    Member
    Posted 11 months ago #

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

  4. Michael Beckwith
    Member
    Plugin Author

    Posted 11 months ago #

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

  5. paumanok
    Member
    Posted 11 months ago #

    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.

  6. paumanok
    Member
    Posted 11 months ago #

    Any thoughts on this item? Thanks!

  7. Michael Beckwith
    Member
    Plugin Author

    Posted 11 months ago #

    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.

  8. paumanok
    Member
    Posted 11 months ago #

    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.

Reply

You must log in to post.

About this Plugin

About this Topic