Forum Replies Created
-
AuthorPosts
-
March 3, 2021 at 3:56 pm in reply to: How much longer we have to wait for Gutenberg support on Piklist #11167
mhwebParticipant@sbruner Thank you for the reply. One of the things I wanted to know was whether the plugin was still in development. I wouldn’t have asked, but recently, I was trying to build some functions, and anywhere I asked, they suggested to do it developing with Gutenberg, and I couldn’t do it, because I depend on Piklist, and I can’t switch right now (I’m too deep in it).
Do you guys have any timeframe to share on a possible release for version 2.0?
Thanks,May 16, 2020 at 8:01 am in reply to: Does Piklist settings saved on posts are exported with WordPress tool #10656
mhwebParticipantthanks,
mhwebParticipantOK, I thinking I’m not doing the right thing here.
I’ve tried the piklist_part_process so that if another field is true on save, it will hide a meta-box block in the editor, but what I’m doing isn’t working, actually nothing happens when I save the post.Here’s a better context:
I have a meta-box in the post editor backend with with radio options, which when on of the options is selected it loads post format for that particular post.
Now, I need to add a format that includes addition options, such as product pricing and buy button, but I need these options to appear only if a particular format is selected. The options can appear on-demand or after a save the post.The problem that, as you said earlier, the conditional options for Piklist won’t remove the actual meta-box block if the format that triggers the options is not selected, and I want to avoid putting everything on a single mete-box, because I need to have the ability to organize and place metaboxes on different locations for a batter workflow.
This is the metabox with the new options that need to appear only when a new format option is selected:
File name: field-affiliate.php<?php /** Title: Affiliate Post Type: post Collapse: false */ piklist('field', array( 'type' => 'group' ,'field' => 'pit_affiliate_buy_button' ,'label' => 'Button' ,'description' => 'Affiliate button' ,'fields' => array( array( 'type' => 'text' ,'value' => 'button title' ,'field' => 'button_title' ,'label' => 'Affiliate button title' ), array( 'type' => 'text' ,'value' => 'button url' ,'field' => 'button_url' ,'label' => 'URL' ), array( 'type' => 'text' ,'value' => 'price now' ,'field' => 'price_current' ,'label' => 'Current Price' ), array( 'type' => 'text' ,'value' => 'list price' ,'field' => 'list_price' ,'label' => 'List Price' ), array( 'type' => 'text' ,'value' => 'discount price' ,'field' => 'discount_price' ,'label' => 'You Save' ) )// end of fields array )); ?>This is the metabox that appears in the right-side of the editor, and includes the radio options:
File name: field-radio-formats.php<?php /* Title: Article Formats Post Type: post Collapse: false Capability: manage_options Context: side Priority: low Locked: false */ piklist('field', array( 'type' => 'radio' ,'field' => 'pit_article_format' ,'label' => 'Normal' ,'description' => 'Choose article format. Default is Standard.' ,'value' => 'format-1' ,'choices' => array( 'format-1' => 'Standard' ,'format-2' => 'Background' ,'format-3' => 'Content Video' ,'format-10' => 'Affiliate Single' ,'format-99' => 'Legacy' ) ,'on_post_status' => array( 'value' => 'lock' ) )); ?>Question 1: Is there any way to other than conditional option to show the entire metabox block only when a particular radio option is selected using the Article Formats metebox?
Question 2: If piklist_part_process should work to accomplish the behavior, is there something wrong with this code:
add_filter('piklist_part_process', function($part) { global $post; // Make sure this is a post edit screen if ( $post && 'post' === $post->post_type ) { // Check that this is the right folder and part if ( 'meta-boxes' === $folder && 'field-affiliate-buy-button.php' === $part[''] ) { if ( 'format-10' !== get_post_meta($post->ID, 'pit_article_format', true) ) { return false; } } } return $part; });Thanks again.
mhwebParticipantCan use piklist_part_process so that the meta-box will only appear if the condition of another field is true after the post has been saved?
https://piklist.github.io/docs/actions-filters/filters/piklist_part_process/
For example:
add_filter('piklist_part_process', function($part) { global $post; // Make sure this is a post edit screen if ( $post && 'post' === $post->post_type ) { // Check that this is the right folder and part if ( 'meta-boxes' === $folder && 'field-affiliate-buy-button.php' === $part['part'] ) { if ( 'format-10' !== get_post_meta($post->ID, 'pit_article_format', true) ) { return false; } } } return $part; });If yes, where I write the filter? Does all functions go in the functions.php regardless?
Thanks,
-
AuthorPosts