WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Register Post Type, Attributes

[Resolved] Register Post Type, Attributes

  • I have registered a Custom Post Type, named PRODUCTS, but now, I can’t use the ‘parent attribute’ in this kind of posts, any ideas?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Use Pages instead.

    Ok, Thanks for reply.
    Sure I could use pages, but I would like to use custom post types, with different names and different custom fields, I’m almost there, because I see the attributes, but just the order attribute, must be a way to have parents in custom post type, or am i wrong?

    must be a way to have parents in custom post type

    Set ‘hierarchical’ => true and make sure your supports include ‘page-attributes’.

    Thanks Michael for taking the time! I’m really trying to make this work as expected, but with no luck so far.

    This is my function in functions.php
    note that, hierarchical is true, capability_type is PAGE and
    supports has page-attributes.

    function product_register() {  
    
            $args = array(
               'label' => __('Products'),
               'singular_label' => __('Product'),
               'public' => true,
               'show_ui' => true,
               'capability_type' => 'page',
               'hierarchical' => true,
               'menu_position' => 4,
               'rewrite' => true,
               'supports' => array('title','editor', 'thumbnail',  'page-attributes')
             );  
    
           register_post_type( 'product' , $args );
       }

    In the admin area I see Products like if the capability_type
    is POST (Bug maybe?) and, of course, I can’t see Parent Attribute

    Anyway, this is how my wp-admin looks like:
    https://dl.dropbox.com/u/3610132/products.png

    Thanks for helping! appreciate 🙂

    You won’t see Parent until you publish at least one Product.

    OMG! Thx a lot, now its working great! 😛

    Note that I can’t get “Template” to show in the Page Attributes module, but that’s another subject.

    did you ever figure out why you’re not seeing “template” in the page_attributes module? I’ve got the same issue.

    Are you sure you need the template dropdown?

    Templates apply to pages really. Your custom post type already has a template, it’s called ‘single-whateveryourcustompostiscalled.php’.

    Make sense?

    m.

    yes, thanks I figured that out. I’m not using single-nnnnn.php for my custom post type templates.

    But I ended up having to implement the page-attributes support anyway because that’s where the “order” field is. I think this is a “miss” on the custom post type feature set.

    People want to build custom post types because the capability of a “post” is insufficient. For example, I want to build an Art Portfolio. An Art Portfolio needs to have sorting capability – it should not be sorted by date. Custom post types appear to be completely restricted to to behaving like “posts” not “pages” when it comes to these basic features.

    A significant amount of work needs to be done to jury-rig the custom post types to have page-like qualities. For example, I can now set the “order” field because I added “page-attribute” support, but I can’t get “order” to appear in the Custom Post Type list. And I can’t get the Custom Post Type list to be sorted by “order” when it’s displayed. All of these very simple things seem to be very complicated to override.

    But I’m still digging for answers!

    Is there a way to set a custom post type’s parent as a static page that has already been created. Maybe have some sort of code that enables the regular static page ‘Parents’ to show up as they do in the pages admin section.

    If further explaining is needed, feel free to ask.

    Thanks for any help.

    @bmil21 Did you figure out how to do that? I also have to do that.

    When you create a custom post type, is it possible to get the “Template” feature to show in the Page Attributes module?

    Someone link me to some info on whats up with this.

    Cheers!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Register Post Type, Attributes’ is closed to new replies.
Skip to toolbar