Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterCan you make a screenshot of the settings?
Anh Tran
KeymasterIs there a possibility to see or extract the code?
Maybe just use
var_dumporprint_r?If you don't mind, please give me the post to register meta boxes. I can check that for you.
November 22, 2016 at 4:14 PM in reply to: Choose custom post type from select/checkbox in a settings page #4531Anh Tran
KeymasterMaybe your problem is the same as in this topic, where the post types are not registered when the code runs. You might want to do something like:
add_action( 'init', 'prefix_register_post_types', 0 ); // 0 means high priority add_action( 'init', 'prefix_hooks', 5 ); // Hooks to 5 when all post types are registered. We should not hook to 10 or higher, because Meta Box already run at that time. function prefix_hooks() { add_filter( 'rwmb_meta_boxes', 'prefix_register_meta_boxes' ); }The problem comes when I added compatibility for WPML.
Anh Tran
KeymasterI guess you probably add filter too soon, when the
get_the_termsfunction doesn't exists. You might want to change your code to something like:add_action( 'after_setup_theme', function() { add_filter( 'rwmb_meta_boxes', 'prefix_register_meta_boxes' ); } );This way, your function runs at
after_setup_themewhere all WP functions are available.Anh Tran
KeymasterYes, you should use the extension "MB Include Exclude". It supports to control the visibility of a meta box based on user role.
Anh Tran
KeymasterThe group field doesn't auto turn the oembed URL into the video. To do that, you need to use a helper code, like this:
$url = $group['paragraph_movie']; echo RWMB_OEmbed_Field::get_embed( $url );Anh Tran
KeymasterYou mean when changing
field_type, the returned value changes? Can you post the code to register this field to check? Thanks.Anh Tran
KeymasterThat's correct! I forgot that you're using the Builder extension ๐
Anh Tran
KeymasterHi Mark, you can add params to the
query_argsto specify the order like'orderby' => 'post_title'.Anh Tran
KeymasterI'm not sure I get what you want! I think using WPML for translation always put something in the DB.
Maybe you should localize your theme/plugin using .po file. Then use poEdit to make translation. That way there's nothing stored in the DB (and you also don't use WPML).
Anh Tran
KeymasterFrom the error above, I guess the problem isn't the code. Probably one of the selected term was deleted or not available. That's why it returns an
WP_Errorobject. Please check that.Anh Tran
KeymasterDid you try this docs? https://wpml.org/documentation/getting-started-guide/string-translation/
Anh Tran
KeymasterSorry, I was thinking this issue is on Github and track there. Please post the code you use to register meta boxes.
Anh Tran
KeymasterI see!
Does your code above work? Because if you set your custom column sortable that way, WordPress simply sets
orderby=navnand you have to hook topre_get_poststo filter by that.By the way, to add sortable columns, you don't need to add a new filter to the extension. WordPress has that filter already (that the extension uses). You can refer to this article for more info:
https://code.tutsplus.com/articles/quick-tip-make-your-custom-column-sortable--wp-25095
Anh Tran
KeymasterHi Dave,
Both plugins work well together without doing anything. Just remember to setup the field ID in MB User Meta match the meta field in Gravity Forms.
-
AuthorPosts