Tagged: update multiple
- This topic has 4 replies, 2 voices, and was last updated 4 years, 10 months ago by
friendlyfire3.
-
AuthorPosts
-
-
March 31, 2017 at 6:09 pm #7883
friendlyfire3Memberend goal: I want to copy a bunch of meta data from one post to the one I’m editing.
I figured I’d start with the update multiple field. Here’s what I have so far:
piklist('field', array( 'type' => 'select' ,'field' => 'update_multiple' ,'label' => __('Update Multiple Fields', 'piklist-demo') ,'choices' => piklist( get_posts(array( 'post_type' => 'event' ,'numberposts' => -1 ,'orderby' => 'title' ,'order' => 'ASC' )) ,array('ID', 'post_title') ) ,'conditions' => array( array( 'type' => 'update' ,'value' => 'true' ,'field' => 'update_multiple_1' ,'update' => __('Value 1', 'piklist-demo') ) ,array( 'type' => 'update' ,'value' => '' ,'field' => 'update_multiple_1' ,'update' => null ) ,array( 'type' => 'update' ,'value' => 'true' ,'field' => 'update_multiple_2' ,'update' => __('Value 2', 'piklist-demo') ) ,array( 'type' => 'update' ,'value' => '' ,'field' => 'update_multiple_2' ,'update' => null ) ) )); piklist('field', array( 'type' => 'text' ,'label' => __('Update 1', 'pilist-demo') ,'field' => 'update_multiple_1' )); piklist('field', array( 'type' => 'text' ,'label' => __('Update 2', 'pilist-demo') ,'field' => 'update_multiple_2' ));That’s as far as I’ve gotten. I can select a post from the select option choices but how do I get the selected post data so I can copy it to the other meta fields?
-
April 1, 2017 at 4:24 pm #7889
SteveKeymasterNot sure exactly, what you are trying to do, but to copy post meta from one post to another you would use get_post_meta() and update_post_meta().
-
April 1, 2017 at 11:13 pm #7890
friendlyfire3MemberThanks steve, I should have been clearer. I am trying to get access to what was selected in the view as the option.
For this part:
'type' => 'select' ,'field' => 'update_multiple' ,'label' => __('Update Multiple Fields', 'piklist-demo') ,'choices' => piklist( get_posts(array( 'post_type' => 'event' ,'numberposts' => -1 ,'orderby' => 'title' ,'order' => 'ASC' )) ,array('ID', 'post_title') )How do I get the post that was selected? Do I need to use jquery or does piklist return it somehow?
-
April 3, 2017 at 1:39 pm #7895
friendlyfire3MemberI think this post is similar.
I’m trying to get the selected post so I can update the other fields. It looks like you solved it but it was done via email and not posted in the forum.
Let me know how it’s possible.
Thanks, Steve!
-
April 5, 2017 at 12:33 pm #7906
friendlyfire3MemberAnyone have any advice here? I’d love to get that selected option back but am not sure just how to do so.
-
-
AuthorPosts
- You must be logged in to reply to this topic.