WordPress.org

Ready to get started?Download WordPress

Forums

Subordinate Post Type Helpers
[resolved] Possible Bug (7 posts)

  1. 10sexyapples
    Member
    Posted 1 year ago #

    Hello Randy ... I was searching everywhere for some help in getting this sort of thing working and came across your video and code here ... so, first things first ... THANK YOU ...

    I am at the tail end of rebuilding a client's site from my initial build of it 7 years ago and needed a new way to recreate an immense hack I did back then to make this type of functionality work.
    The scenario here is Artist and their subordinate Bio, Review, and Statement ... the goal is to go from the artist archive to their single tsa_artist post type template and then from within that template have all their subordinate pages listed. The sidebar stays the same throughout as an index to all things Artist.

    The work you've done here is absolutely perfect, but, I'm running into a bit of a wall.

    I have already created the post types ( I roll my own here ) and switched all the old posts to their appropriate new homes, prior to discovering that their was no way I was going to pull this off with many2many ... just keeping the artist's featured image/aka profile pic at the top of the sidebar looks impossible without resorting back to my 06 hack.

    The steps I've taken thus far are to activate your code ... then comment out my initial registration ( registration only ... all my $args/$labels remain ).

    The result is that everything appears to be okay, and I initially thought I could just delete the old posts and recreate them with the new thickbox interface so that the relationships would show, but, when I went to do that I noticed that all three metaboxes share the same name inputs etc. ... the Title is correct on all three, but, the inputs are all mirrors of each other.

    I went ahead and attempted a test, and the post also showed up in all three metaboxes ... and my permalinks are set up fairly normal, but, the permalink to the test subordinate post showed it as being nested within a sibling subordinate instead of the parent ... in other words, the bio I made was inside reviews.

    I know this is a book, but, I do try to be thorough~

    I would love to send screenshots to show you what's happening here and stay in touch as I implement this tomorrow ( yep, have just one day to finish ) if you have an email and are available ... otherwise, any insight you may have on what could be happening here would be greatly appreciated ;-)

    http://wordpress.org/extend/plugins/subordinate-post-type-helpers/

  2. randyhoyt
    Member
    Plugin Author

    Posted 1 year ago #

    I found the bug, and I have addressed it version 0.2.3. (I also added a WYSIWYG editor for the content editor.) Please upgrade and let me know if it fixes it!

  3. 10sexyapples
    Member
    Posted 1 year ago #

    So far so good ... I'm going to try to keep my questions in the appropriate places, so, I'll ask this here ...

    I have a number of existing posts, as my custom post type already existed prior to implementing subordinates. Is there any way to automate the trigger for them to be recognized by the parent post without having to go through and recreate them all?

    Question two here might seem silly, but, what is the best method for calling subordinate posts in templates, for instance in my case a sidebar list of the parent and the subordinate posts?

    Thanks again for your work with this and I hope to give plenty of feedback ;-)

  4. randyhoyt
    Member
    Plugin Author

    Posted 1 year ago #

    (1) EXISTING POSTS: How are they connected now? Do you have the parent specified in a custom field? Here are some ideas:

    * The fastest way to do it is to write a SQL statement to update the post_parent field on the posts table with the corresponding value from the postmeta table.

    * If that sounds too complicated, then check out this code snippet: [http://janina.tumblr.com/post/3588081423/post-parent-different-type]. If you set it up correctly, will give you a dropdown field when editing the Bio where you can pick the parent Artist.

    ---- You'll have to manually edit each one and save it, but it should be easier than recreating them all. Worst case, you'd have to select the parent artist from the dropdown ...

    ---- ... but if you are really clever with that technique, you can change the code that says 'selected' => $post->post_parent to something like 'selected' => get_post_meta($post->ID, "artist_id", true) so that the parent is automatically selected. You'd just have to open every sub post record and hit save to get the connection established.

    (2) DISPLAYING CHILDREN: You'll want to use get_posts: [http://codex.wordpress.org/Template_Tags/get_posts] Specify the child post type for the post_type parameter, and then specify the parent post ID for post_parent.

  5. 10sexyapples
    Member
    Posted 1 year ago #

    They aren't connected at all right now, just posts in a custom post type ... perhaps it is something that could happen on registering the subordinate post type now that I think about it. As in, when an existing custom post type with posts that already exist in the database becomes a subordinate post type, recursively set the parent post ID?

    Further explanation:

    Back in the old build of the site ( 2006 ) I had to create this with pages and subpages for every artist. So, artist page and then sub page for review, statement, bio. I have switched them all over to custom post types and that's where they stand now.

  6. 10sexyapples
    Member
    Posted 1 year ago #

    I should be able to just run a SQL statement to inject the Parent Post ID into all of them actually ... wow ... no, that won't do ... also realized how ridiculous my thought of automating this was just now ... I will grab the metabox ;-)

  7. randyhoyt
    Member
    Plugin Author

    Posted 1 year ago #

    It sounds like the best approach will be to temporarily add a dropdown on all the subordinate posts like in this article ...

    http://janina.tumblr.com/post/3588081423/post-parent-different-type

    ... and then edit each sub post individually to select the parent. After that, you can remove the dropdown and edit them in the sub post popup.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic