Forum Replies Created
-
AuthorPosts
-
July 28, 2016 at 11:19 AM in reply to: Trying to show the taxonomy name of a custom post type with a shortcode #3764
Anh Tran
KeymasterCan you just try
[rwmb_meta meta_key=“YOUR META KEY” taxonomy=“presenter”]? I see you missedmeta_key.July 28, 2016 at 11:16 AM in reply to: How can I have a pre-embedded video in a meta box (for a tutorial) for my blog writers? #3763Anh Tran
KeymasterHi,
You can use
custom_htmlfield. It allows you add custom HTML code for a field via thestdparam. So you can enter the embeded code of the video for the field. It can’t be edited.Anh Tran
KeymasterHi Nick,
The development version on Github has a fix for this. It adds a new param for map field
api_keywhere you should enter your Google Maps API key. It actually doesn’t relate with the Group extension, so the error must be somewhere else. Can you please post the error here?Thanks
AnhAnh Tran
KeymasterThanks, I will check it.
Anh Tran
KeymasterHi,
Do you see any error in the MB Builder screen?
Anh Tran
KeymasterHi @Ivo,
The 'Supplementary Information' is a child field of the parent group, so you have to access to its value through the parent value, like this:
$group = rwmb_meta( 'saq_id' ); $supplementary = isset( $group['supplementary'] ) ? $group['supplementary'] : array(); foreach ( $supplementary as $single_supplementary ) { $value = isset( $single_supplementary['sub_text'] ) ? $single_supplementary['sub_text'] : ''; echo $value; }Just think about group and sub-group as a hierarchy, everything will be clear 🙂
Anh Tran
KeymasterYes, but that requires some custom code. Here is what I tried:
- In your plugin file or theme's
functions.phpadd this code:add_action( 'admin_init', 'prefix_custom_post_column', 20 ); function prefix_custom_post_column() { require_once 'custom.php'; new Test_Admin_Columns( 'post', array() ); }- Create a new file
custom.phpand enter the following code:class Test_Admin_Columns extends MB_Admin_Columns_Post { public function columns( $columns ) { $columns = parent::columns( $columns ); /** * Add more column in a specific position * * @param string $position New column position. Empty to not specify the position. Could be 'before', 'after' or 'replace' * @param string $target The target column. Used with combination with $position */ $position = ''; $target = ''; $this->add( $columns, 'column_id', 'Column Title', $position, $target ); // Add more if you want return $columns; } public function show( $column, $post_id ) { switch ( $column ) { case 'column_id': echo 'Column content'; break; // More columns } } }Note that the call
new Test_Admin_Columns( 'post', array() );is specific forpost. You can change it to any custom post type if you want.Anh Tran
KeymasterYes, I do. Will release it as soon as I find a solution for ajax handling 🙂
Anh Tran
KeymasterDid you set value for
$var_options? Here is my test:<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' ); function your_prefix_register_meta_boxes( $meta_boxes ) { $prefix = 'mbox_'; $var_options = array( 'a' => 'First option', 'b' => 'Second option', ); $meta_boxes[] = array( 'title' => esc_html__( 'Standard Fields', 'your-prefix' ), 'fields' => array( array( 'name' => esc_html__( 'Depends of', 'pbc' ), 'id' => "{$prefix}depends", 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => array( // SELECT BOX VARIATIONS array( 'name' => __( 'Variation', 'pbc' ), 'id' => "{$prefix}depvar", 'type' => 'select', 'options' => $var_options, 'multiple' => false, 'std' => '', 'placeholder' => __( 'Select a Variation', 'pbc' ), ), ), ), //array ), ); return $meta_boxes; }And here is the result:
Anh Tran
KeymasterHi Cristian,
I've just tested with your code and it works for me: http://prntscr.com/bvyab5
Looks like the saved value doesn't have a correct format. Did you have value for the group before? Something like you set up the group, entered a value, and then changed the group settings. That probably makes the old saved data not compatible with the new settings.
Anh Tran
KeymasterHi @jpomranky,
Can you please check the version of the Group extension you're using? I think I fixed this bug in the extension and keep the
clone.jsfile untouched.Anh Tran
KeymasterHi Nicolas,
You can store the changed fields and then process the log when the post is saved. Here is what I suggest:
class MB_Log { protected $fields = array(); public function __construct() { add_filter( 'rwmb_value', array( $this, 'check_field_change' ), 20, 3 ); add_action( 'rwmb_after_save_post', array( $this, 'log' ) ); } public function check_field_change( $new, $field, $old ) { if ( $new !== $old ) { $this->fields[] = $field; } return $new; // Do not change the value } public function log() { foreach ( $this->fields as $field ) { // Log } } }Anh Tran
KeymasterHi Nicolas,
I think you can hook to
rwmb_valuelike this:add_filter( 'rwmb_value', 'prefix_check_field_change', 20, 3 ); function prefix_check_field_change( $new, $field, $old ) { if ( $new !== $old ) { // Log } return $new; // Do not change the value }Anh Tran
KeymasterThanks for reporting. I will check it.
Anh Tran
KeymasterThe
$contact['phone']is an array, so you need to loop for it:// Echo name, email if ( ! empty( $contact['phone'] ) ) { echo '<p><label>', __( 'Phone numbers:', 'textdomain' ), '<label> '; foreach ( $contact['phone'] as $k => $phone ) { echo $k ? ', ' : '', $phone; } // Or faster echo implode( ', ', $contact['phone'] ); } -
AuthorPosts