Tagged: groups
- This topic has 8 replies, 3 voices, and was last updated 6 years, 10 months ago by
jcrist.
-
AuthorPosts
-
-
December 24, 2014 at 12:10 pm #3128
jcristMemberIs there any way to sort the related posts? For example, I’m working on a lawyer website where we have a CPT for areas of practice and the attorney profiles will have a relationship to them. However, a lawyer may focus on one AOP and want it displayed first.
Happy holidays
-
December 25, 2014 at 2:07 pm #3130
SteveKeymasterCurrently the Post Relationship field cannot be modified.
However, you can do something similar if you want.
In Piklist demos > Advanced Tab > Content Section (Grouped) field. We pull in Posts.
You can use this field as a guide to create your own. The Post ID would be saved as meta which you can query using get_posts.
Let us know if you need help.
-
December 26, 2014 at 1:25 am #3133
jcristMemberThanks for the tip, Steve. This should work just fine for one-way relationships but say I also wanted to display the lawyers on the AOP page?
-
December 26, 2014 at 11:26 am #3134
SteveKeymasterYou should be able to use Meta Query to go the other way. Let me know if that works for you.
-
March 26, 2015 at 3:23 pm #3511
gustavolanzasMemberSteve – thanks for the insight. I have a similar case to jcrist.
Can you tell me where I could see the code to produce that particular demo? I’m an experienced php / wp dev, but new to wp. I’ve poked around the /add-ons/piklist-demos directory in the plugin, but didn’t find it.
-
March 26, 2015 at 4:01 pm #3513
SteveKeymaster@gustavolanzas– Welcome to the Piklist community!
The demo I was talking about can be found here:
piklist/add-ons/piklist-demos/parts/meta-boxes/field-add-more.phpWe pull in posts and display them in a dropdown.
Let me know if that was not what you were asking about.
-
March 26, 2015 at 10:56 pm #3515
jcristMemberWhile the solution did work just fine, it feels a little cumbersome. I saw a post somewhere that said you are rethinking the post-relate, any insight on that?
I have an idea, and I’m sure you’ve have one similar but I’ll throw it out there anyway — allow users to sort related-posts inside of the meta-box like http://jsfiddle.net/PtskU/ so the order is customizable on a post-by-post basis. I figure that since there’s a new table in the DB for post-relationships, you could add something like the menu_order column in wp_posts.
-
March 27, 2015 at 10:45 am #3518
-
March 27, 2015 at 11:10 am #3520
jcristMemberThis might be a bit specific for my use but I was thinking that the related-posts could be ordered on a page-by-page basis. For example, on the attorney/aop instance above, Attorney1 wants AOP2 to display first while Attorney2 wants AOP1 first.
Kind of like what ACF does with their relationship field, but keeping it inside a taxonomy box and keeping it (mostly) the wordpress way. This would require the order to be saved in either post_meta or somewhere else right? I suggested an additional column so you wouldn’t have to query the postmeta just to get the order.
-
-
AuthorPosts
- You must be logged in to reply to this topic.