WordPress.org

Ready to get started?Download WordPress

Ideas

Parent from different post type

  1. magadanski_uchen
    Member

    12345

    It would be nice to have a way to set a parent entry from a different post type.

    Initially this can simply be a setting when registering the post type -- parent_post_type = page. In case the idea evolves (and I'm sure it will) it can be implemented in a different way.

    Posted: 1 year ago #
  2. AusFastLife
    Member

    12345

    Yes! This is exactly what I need. I can't make the "Blog" link in my menu highlight as the active page when reading a single post since single posts are not recognised by WordPress as the child of the Blog page. Some way of assigning which menu link or page is the "parent" of the single posts would be a life saver.

    Please everyone vote for this so it gets implemented!!

    Posted: 1 year ago #
  3. magadanski_uchen
    Member

    12345

    I actually had something else in mind. My suggestion had more to do with custom post types, instead "parent" classes in menu for blogposts.

    Posted: 1 year ago #
  4. Unsal Korkmaz
    Member

    I think you are looking for "Posts 2 Posts" plugin:
    http://wordpress.org/extend/plugins/posts-to-posts/

    Posted: 1 year ago #
  5. magadanski_uchen
    Member

    12345

    I am aware of the Posts2Posts plugin, yet I believe this is a very basic feature that should not be achieved through a plugin, rather it should be built into WordPress core.

    Posted: 1 year ago #
  6. Justin Tadlock
    Member

    12345

    You can already set a parent like this. In fact, WP core does it with attachments.

    Posted: 1 year ago #
  7. magadanski_uchen
    Member

    12345

    Although you might be able to do this programatically it renders permalinks irregular.

    Moreover you are not allowed to do this through the admin panel, although it is a matter of a simple filter to change the post type for the items in the "Parent" dropdown.

    Posted: 1 year ago #
  8. deepwater wells
    Member

    This can be done via two filters (one for post edit, one for quick edit):

    page_attributes_dropdown_pages_args
    found in wp-admin/meta-boxes.php, line ~650

    quick_edit_dropdown_pages_args
    found in wp-admin/includes/class-wp-posts-list-table.php, line ~900

    Posted: 11 months ago #
  9. magadanski_uchen
    Member

    12345

    If you try this (like I did -- at least with the page_attributes_dropdown_pages_args filter) you will run in all kinds of complications.

    First is that the function that you pass the attributes from the page_attributes_dropdown_pages_args filter is not actually get_posts (or in any way based on WP_Query), rather this uses get_pages and prevents you from further using pre_get_posts.

    I believe I mentioned in my previous comment that this part is easy. The follow-up issues have to do with invalid permalinks.

    Other than that when the entries are listed in the admin panel the parent listed from a different post type is not very user friendly in my opinion.

    Posted: 11 months ago #
  10. Jam Viet
    Member

    I also need this function to creat a forum, a thread will open and any reply is a post's child

    Posted: 8 months ago #

RSS feed for this topic

Reply »

You must log in to post.

  • Rating

    12345
    6 Votes
  • Status

    This is plugin territory