Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterHello,
The shortcode only output the whole value of the custom field, in this case - the whole fieldset. In order to display only the values, you can create a custom shortcode to get and show the field value, like this:
add_action( 'init', function () { add_shortcode( 'my_meta', function ( $atts ) { $atts = shortcode_atts( [ 'meta_key' => '', 'post_id' => get_the_ID(), ], $atts ); $values = rwmb_meta( $atts['meta_key'], array(), $atts['post_id'] ); $output = ''; foreach ( $values as $value ) { $output .= $value . ', '; } return $output; } ); } );March 26, 2018 at 5:15 PM in reply to: type="post" / field_type="checkbox_list" returns only single id #8961Anh Tran
KeymasterThe strange thing is the code works fine to me. Where do you put the
add_filtercode? Is it under any condition?March 26, 2018 at 5:14 PM in reply to: โ Option Group support for Select/Select Advanced Field Types #8960Anh Tran
KeymasterHello,
Thanks for bringing an interesting question. I was thinking about this, too. However, the problem is changing the syntax, which requires a lot of code to be modified. Not sure how to do it best and clean.
Anh Tran
KeymasterHi,
This is a feature that has been on our list for a long time. The reason we couldn't implement it because it's quite complicated for some fields like
file_advancedortaxonomy. We'll probably take a look at that again and try to implement for simple fields.March 24, 2018 at 10:54 AM in reply to: Using Custom Attributes from rwmb_before_save_post action #8943Anh Tran
KeymasterYes, the documentation is updated ๐
March 24, 2018 at 10:46 AM in reply to: type="post" / field_type="checkbox_list" returns only single id #8942Anh Tran
KeymasterHello,
I've just tried your code and see it works. The helper function returns an array of IDs. Maybe you register meta boxes only for the admin (with a check like
is_admin())?Anh Tran
KeymasterHello,
Thanks for the question. All the plugins will work normally with or without Gutenberg. Gutenberg has no effect to the plugins on the frontend at all.
By the way, if you don't like Gutenberg, you can always disable it and use the classic editor.
Anh Tran
KeymasterI will do that today!
Updated: the version 4.14.1 has been released!
Anh Tran
KeymasterHello,
Unfortunately, Gutenberg doesn't support contexts. It has only one place to show meta boxes. So, please just remove the
contextsparam from the meta box settings.March 23, 2018 at 2:49 PM in reply to: Using Custom Attributes from rwmb_before_save_post action #8926Anh Tran
KeymasterHello,
I've just added
rwmb_after_save_fieldhook, that can help you ease the pain ๐Here is the code using it:
add_action( 'rwmb_after_save_field', function ( $null, $field, $new, $old, $post_id ) { $pre = ''; if ( ! empty( $field['attributes']['mod_lock'] ) ) { $pre = 'pending_'; } $storage = $field['storage']; if ( $new !== $old ) { $storage->update( $post_id, $pre . $field['id'], $new ); } if ( empty( $new ) ) { $storage->delete( $post_id, $pre . $field['id'] ); } }, 10, 5 );Anh Tran
KeymasterHi,
The files field is a sub-group of the
press_group, so you should not get sub-group's value directly withrwmb_meta. Instead, get the value from the parent grouppress_group, like this:$group = rwmb_meta( 'press_group' ); $files = isset( $group['Press_Files_group'] ) ? $group['Press_Files_group'] : array(); print_r( $files );Anh Tran
KeymasterIn the link I pasted above, there's full code to detect if the URL is a valid oembed, you can try it, like this:
$url = get_post_meta( get_the_ID(), 'oembed', true ); $args = ['width' => 640]; $embed = wp_oembed_get( $url, $args ); if ( ! $embed ) { $embed = $GLOBALS['wp_embed']->shortcode( $args, $url ); } if ( $embed ) { echo $embed; } else { // Do something when there's no controls if you want }Anh Tran
KeymasterHello,
Currently, it's not worked in the frontend yet. We're working on adding this feature. Probably in the next 1 or 2 weeks. The code is completed, but there's a bug that we need to fix before releasing.
Anh Tran
KeymasterHello, I've just checked and don't find it in the file. Probably I removed it in the version 1.0.1. Can you try redownloading again?
-
AuthorPosts