Forum Replies Created
-
AuthorPosts
-
May 10, 2016 at 3:10 pm in reply to: File field, edit image when clicking linked image preview #6477
jivedigMemberRock on. Thanks Steve (and Jason)!
May 10, 2016 at 10:59 am in reply to: File field, edit image when clicking linked image preview #6472
jivedigMemberIt’s definitely not working the same for me though. When I click an existing featured image in the Featured Image metabox, it opens the featured image modal with the existing featured image already selected, so I can edit title/alt/desc/etc.
When I click the existing image in the Piklist file upload field it opens the modal with no image selected. So I have to find and re-select my image in order to edit the title/alt/desc.
Are you seeing differently? Maybe this only happens on term meta?
jivedigMemberThanks! Without spending a ton of time, I found a workaround.
This checks if there is an image, then creates a button that sends you to the edit image page.$cat_id = isset($_GET['tag_ID']) && ! empty($_GET['tag_ID']) ? absint($_GET['tag_ID']) : ''; $image = ''; if ( $cat_id ) { $image = get_term_meta( $cat_id, 'll_term_image', true ); } if ( $image ) { echo '<p><a target="_blank" class="button" href="' . get_edit_post_link( $image ) . '">Edit current image in new window</a></p>'; }Mind you, this is term meta on categories for me. But you get the idea.
jivedigMemberSorry i’m probably not explaining correctly.
Attached a screenshot to hopefully clarify.
Attachments:
You must be logged in to view attached files.
jivedigMemberEven if there were multiple images, clicking on the already uploaded image should bring me to the modal where i can edit the title/alt/caption associated with that image. Same window as when you click an existing image in the media uploader. See attached screenshot for the modal that I would expect to open when clicking an already uploaded file.
Attachments:
You must be logged in to view attached files.
jivedigMemberYou may need to set a custom scope and manually update the CPT via the piklist action.
'scope' => 'update_daves_cpt',Then:
add_action( 'piklist_save_field-connect_resource_to_step', 'update_daves_cpt', 10, 1 ); function update_daves_cpt( $fields ) { // Manually do some awesomeness }Note: add the same scope to all the fields you want for the CPT update
jivedigMemberNo time to test now, but I was going to suggest using the
valueparameter to preload values when you don’t want to use the query var.
jivedigMemberDave, something is not right. Can you paste your code here? Or even DM it in our Genesis Slack group so I can test?
You should absolutely have the <form> wrap. I never _not_ had it work.
jivedigMemberI don’t think you need the cpt name in the query string. WP uses unique ID’s regardless of post_type. I have this working with just ?_post[ID]=57 on a CPT.
jivedigMemberHowdy Dave! I was hoping i’d spark some Piklist interest in you 😉
You’ve got an interesting use case here, i’d be curious to test it out as well at some point.Here’s a quick tip, don’t use the shortcode in a template… do this:
piklist::render('forms/job');The only way i’ve tested editing an existing post is adding a query var to the url e.g( example.com/my-form-page/?_post[ID]=123 )
I was hoping to find a way to ‘load’ a form with post values where the ID comes from somewhere else. Naturally we could grab the values ourselves and put them in the field ‘value’ parameter, but that’s very manual (CMB2 style).
jivedigMemberPardon the jump in here, but totally relevant. When using a front end form to create a new post/cpt, how can we redirect to the new post? Along the same lines, just returning the post ID of the newly created post would be great for other things as well. Possible?
February 17, 2016 at 4:34 pm in reply to: on_post_status when editing post with front end form #5951
jivedigMemberFWIW, this is how I’m successfully doing this now.
$edit_post_data = isset($_GET['_post']) ? $_GET['_post'] : null; $edit_post_id = isset($edit_post_data['ID']) ? absint($edit_post_data['ID']) : -1; $edit_post_status = get_post_status($edit_post_id); $edit_post_published = ( 'publish' === $edit_post_status ) ? true : false; // Hide field if editing a published post if ( ! $edit_post_published ) { // My piklist field(s) }
jivedigMemberJust jumping in to say that this is working fine for me.
piklist('field', array( 'type' => 'radio', 'scope' => 'taxonomy', 'field' => 'program_type', 'choices' => piklist(get_terms('program_type', array( 'hide_empty' => false, )), array( 'term_id', 'name', ) ), 'required' => true, ));
jivedigMember@jason: PHEW! I’m deep in this plugin, and LOVING Piklist. So happy I happened to sit at your table at WordCamp US 🙂
Without custom scope Piklist would lose a lot of its power IMO.
Thanks! -
AuthorPosts