• Resolved Venutius

    (@venutius)


    Would it be possible for this plugin to display child pages from all post types?

    I have a structure where the parent is always post_type_a, but it’s children can be of post_type_a, b or c.

    I’m assuming that you are only checking for children within the post type of the parent page. Would it be possible to change this so that all post types can be checked.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author caterhamcomputing

    (@caterhamcomputing)

    Hi.

    I am not sure how you can create a post with a parent of a different post type? (Not that I have tried …)

    Do you mean that you have various items listed in a custom menu?

    Thread Starter Venutius

    (@venutius)

    No, I have a custom post type – ‘Site’ which has child pages of ‘Site’ and ‘structure’ allocated to it for example. So in other words the parent post type is not the same post type as the child.

    You can see what I’m doing here:

    https://wordpress.stackexchange.com/questions/181134/how-to-set-parent-child-relationship-between-differents-custom-post-types

    Imagine I was setting up a set of pages for a band, I could have one post type which would be the band main page, then I could set up post types for videos, albums, concerts etc. and have them linked back to the original bands page using hierarchy. Seems like the sort of stuff you’d want to do when you have different types of content in a collection if you get my drift.

    Plugin Author caterhamcomputing

    (@caterhamcomputing)

    Given how non-standard this whole approach is, I don’t think this is something that I would build into the core … it strikes me that this is something that may be better achieved with non-hierarchical posts and categories (or even custom taxonomies) …

    However, the plugin has many hooks and filters – you could try adding something like the following to your theme’s functions.php:

    function ccchildpages_show_any_type_of_child($args) {
        $args['post_type'] = 'any';
    
    return $args;
    }
    add_filter( 'ccchildpages_query_args' ,'ccchildpages_show_any_type_of_child' );
    add_filter( 'ccchildpages_list_pages_args' ,'ccchildpages_show_any_type_of_child' );

    … I haven’t had the time to try this out, so I can’t say it will definitely work.

    This should change the child post_type to be 'any' rather than being based on what is passed to the shortcode or the parent post_type.

    Let me know if this helps, or at least gets a bit closer to what you want to do.

    • This reply was modified 7 years ago by caterhamcomputing. Reason: missed out returning the value!
    Thread Starter Venutius

    (@venutius)

    Thanks a lot for this, it worked first time!

    You could be right, I may end up reverting to just a single post type for this, still exploring the art of the possible.

    Thanks for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Suport for multiple post-types for child pages’ is closed to new replies.