Forum Replies Created
-
AuthorPosts
-
friendlyfire3MemberThanks for all the hard work, Jason and team. You’ve all saved us time, energy and tears.
friendlyfire3MemberI see what you’re trying to do and have tried something similar myself (editing a related post meta in the parent) but wasn’t able to do so in any clear or useful way only via piklist.
I’m also having issues with the conditionals using addmores and nested groups. I’ve just decided to wait until the feature is released (hopefully soon.)
friendlyfire3MemberI updated from the same version and have a ton of code that works just fine.
friendlyfire3MemberHaving this same issue. Need nested fields as I also need the rearrange (drag n drop order) option. However, I also need the show/hide functionality but it’s not working on 0.9.9.12.
friendlyfire3MemberAnyone have any advice here? I’d love to get that selected option back but am not sure just how to do so.
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!
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?
friendlyfire3MemberSuper helpful, Jason. Close this puppy out!
friendlyfire3MemberI’m actually storing urls, not ids. However, your second post makes sense. Let me play with that and get back to you.
Thanks for the response.
friendlyfire3MemberYes, I want to add multiple values for a key. What type of field does this? And are there docs that help understand which is which?
I’m currently using:
piklist('field', array( 'type' => 'file' ,'field' => 'featured_media_url' ,'label' => __('Featured Media Url', 'piklist-demo') ,'attributes' => array( 'class' => 'regular-text' ,'readonly' => 'readonly' ) ));
friendlyfire3MemberBump. Any suggestions on this?
friendlyfire3MemberThanks. However, I don’t want to repeat fields. I want to repeat an entire metabox.
friendlyfire3MemberHey Steve, sorry to drudge up this post but took some time off and just getting back to this.
How would I go about getting a list of posts related to the user on the frontend?
I’ve tried this (some code excluded for brevity):
$user_id = get_current_user_id(); $key = '__relate_post'; $single = false; $user_posts = get_user_meta($user_id, $key, $single ); $related_proposals = get_posts(array( 'post_type' => 'proposal' // Set post type you are relating to. ,'posts_per_page' => -1 ,'post_belongs' => $user_id ,'post_status' => 'publish' ,'suppress_filters' => false // This must be set to false )); $output = ''; if (!empty($related_proposals) ) { $output .= '<ul>'; foreach($related_proposals as $related_proposal) { $output .= '<li><a href="'.get_post_permalink($related_proposal->ID).'">'.$related_proposal->post_title.'</a></li>'; } $output .= '</ul>'; } return $outputThe above returns absolutely nothing.
and then I tried this:
$user_id = get_current_user_id(); $key = '__relate_post'; $single = false; $user_posts = get_user_meta($user_id, $key, $single ); $related_proposals = get_posts(array( 'post_type' => 'proposal' // Set post type you are relating to. ,'posts_per_page' => -1 ,'post_belongs' => $user_posts ,'post_status' => 'publish' ,'suppress_filters' => false // This must be set to false )); $output = ''; if (!empty($related_proposals) ) { $output .= '<ul>'; foreach($related_proposals as $related_proposal) { $output .= '<li><a href="'.get_post_permalink($related_proposal->ID).'">'.$related_proposal->post_title.'</a></li>'; } $output .= '</ul>'; } return $outputThis returns all posts for the type- not just the ones associated.
And then tried this:
$user_id = get_current_user_id(); $key = '__relate_post'; $single = false; $user_posts = get_user_meta($user_id, $key, $single ); $related_proposals = get_posts(array( 'post_type' => 'proposal' // Set post type you are relating to. ,'posts_per_page' => -1 ,'include' => $user_posts ,'post_status' => 'publish' ,'suppress_filters' => false // This must be set to false )); $output = ''; if (!empty($related_proposals) ) { $output .= '<ul>'; foreach($related_proposals as $related_proposal) { $output .= '<li><a href="'.get_post_permalink($related_proposal->ID).'">'.$related_proposal->post_title.'</a></li>'; } $output .= '</ul>'; } return $outputand using “include” rather than post_belongs works but if there’s no ids in the array from the user meta, then all posts show up.
None of these do what I intend. I just want to show only the posts that we’ve related to the user.
You really need better docs on this relate stuff! 😉
friendlyfire3MemberThanks, Steve and happy new year!
This just seems to create an empty field on the view in wp-admin. I tried changing the type to checkbox but notta.
Any suggestions or do you have any learning guides on the relate system? I can only seem to find things in the forum and only in bits and pieces.
friendlyfire3MemberWhat are you trying to do, exactly?
-
AuthorPosts