Forum Replies Created
-
AuthorPosts
-
November 30, 2015 at 2:14 PM in reply to: Can't use wp_query "meta_key" parameter to filter posts #1825
Anh Tran
KeymasterHi, as I understand, there are 2 problems here:
1. Filtering WP_Query directly with meta values from group
2. Get the meta values from group outside the loop and use them to filter the queryRegarding the 1st problem: it's the same problem of sanitization data as in the link you provided. Data for a group is saved as a sanitized string of an array. So it's can't be used directly to filter the query.
The 2nd issue seems the solution you made to filter the query, by getting the meta values first (and maybe compare them with a specific value). It's very simple to get the value outside the loop. All you need to do is providing the 3rd param for
rwmb_metafunction: the post ID, like this://END LOOP $post_id = ''; // Set the post ID here $META_ID = 'AUCTION_HERO'; $text_block = rwmb_meta($META_ID.'_text_block', '', $post_id ); echo $text_block['end_date_AUCTION_HERO_'.$META_ID];Anh Tran
KeymasterHi Bravebits,
I've test with your meta boxes again. It seems that you not use use Meta Box as normally way (You extends Meta Box class, then do some change inside), so I can't tell you your problem with your code but I can make sure that it works properly if you register as normal way, like this guide:
https://metabox.io/docs/registering-meta-boxes/
Also, you don't have to use
rwmb_outside_conditionsfilter. You can use that filter if you want to hide some element outside meta box. For example: post title, categories, post excerpt, etc...I have modified your code, you can put this to your theme functions.php to see it works:
add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) { // Additional meta box for post. $meta_boxes[] = array( 'id' => 'wr_post_option', 'post_types' => array( 'post' ), 'title' => _( 'Post Settings' ), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array( array( 'name' => _( 'Enable large post' ), 'id' => 'masonry_large', 'type' => 'checkbox', 'desc' => _( '<i>Support Masonry layout only</i>' ), 'std' => 0, ), array( 'name' => _( 'Add image gallery' ), 'id' => 'format_gallery', 'type' => 'image_advanced', 'visible' => array( 'post_format', 'gallery' ) ), array( 'name' => _( 'Video Source' ), 'id' => 'format_video', 'type' => 'select', 'options' => array( 'link' => _( 'Video Link' ), 'file' => _( 'Video Upload File' ), ), 'visible' => array( 'post_format', 'video' ), ), array( 'name' => _( 'Video Link' ), 'id' => 'format_video_url', 'desc' => _( '(Support Youtube and Vimeo video)' ), 'type' => 'oembed', 'visible' => array( 'format_video', '=', 'link' ), ), array( 'name' => _( 'Upload video' ), 'id' => 'format_video_file', 'desc' => _( 'Support .mp4 file format only' ), 'type' => 'file_advanced', 'max_file_uploads' => 1, 'mime_type' => 'video', 'visible' => array( 'format_video', '=', 'file' ), ), array( 'name' => _( 'Audio Source' ), 'id' => 'format_audio', 'type' => 'select', 'options' => array( 'link' => _( 'Soundcloud Link' ), 'file' => _( 'Upload audio' ), ), 'visible' => array( 'post_format', 'audio' ), ), array( 'name' => _( 'Soundcloud Link' ), 'id' => 'format_audio_url', 'type' => 'oembed', 'visible' => array( 'format_audio', '=', 'link' ), ), array( 'name' => _( 'Upload Audio' ), 'id' => 'format_audio_file', 'desc' => _( 'Support .mp3 file format only' ), 'type' => 'file_advanced', 'max_file_uploads' => 1, 'mime_type' => 'audio', 'visible' => array( 'format_audio', '=', 'file' ), ), array( 'name' => _( 'Quote content' ), 'desc' => _( 'You can write the Quote content here.' ), 'id' => 'format_quote_content', 'type' => 'textarea', 'cols' => '30', 'rows' => '6', 'visible' => array( 'post_format', 'quote' ), ), array( 'name' => _( 'Quote author' ), 'id' => 'format_quote_author', 'type' => 'text', 'clone' => false, 'visible' => array( 'post_format', 'quote' ), ), array( 'name' => _( 'Link to' ), 'id' => 'format_link_url', 'type' => 'text', 'visible' => array( 'post_format', 'link' ), ), ) ); return $meta_boxes; } );Regards
Tan Nguyen
Anh Tran
KeymasterHi,
I think using TGM class is still the best way to handle the dependencies in themes and plugins. I'm working on autoload for the main plugin to make it easier to load in themes and plugins. Someone recommended me the Redux Framework, too :).
In the meantime, if you can:
- Use TGM class, or
- Load the extensions directly by including the main file of the extensions (the file which has the same name as the folder), or
- Use a small script like this https://gist.github.com/mathetos/7161f6a88108aaede32a to check if the extension is loaded or not, then run your code.Anh Tran
KeymasterHi bravebits,
This bug caused when Meta Box 4.6 use new structure for File Advanced and Image Advanced, we're fixing this bug. If you want to fix immediately, please replace this file:
https://github.com/rilwis/meta-box/blob/0054dce58a359d71058c057190965afc62da1631/js/media.jsI'm looking to your code and will reply you soon.
Anh Tran
KeymasterWe resolved this bug via email and the fix is added in the latest version of MB Builder. Please update the plugin.
November 24, 2015 at 8:15 AM in reply to: if ( ! empty ) returning blank fields rather than else content #1805Anh Tran
KeymasterI see. Can you please update the Meta Box to 4.7.2 and Group to 1.0.3? The 1.0.3 version of Group has a fix for this.
Anh Tran
KeymasterHi, the extension and the plugin Meta Box does not set image size. The helper function (in the example above) has a parameter to get custom size for image.
Not sure what are you going to do with this, but why don't you just create new image size in your theme? It's something belong to theme's functionality.
November 20, 2015 at 11:12 PM in reply to: if ( ! empty ) returning blank fields rather than else content #1789Anh Tran
KeymasterWhich version of the Meta Box and Group are you using? There were some problems of the plugin and group which made them didn't save the value correctly. Can you please update to the latest version and see if it's resolved?
If it's not, can you please post the code you setup the fields? Thanks.
Anh Tran
KeymasterHi, can you please post your code?
Anh Tran
KeymasterHi Bravebits,
This bug is the compatilibity bug with Conditional Logic addon and Meta Box plugin. We're in progress to fix this bug, will be released within 2 days.
Btw, I've tested with your provided code and it works properly, perhaps your provided code not same as your code you're testing in video.
Thanks for your patience.
Tan Nguyen
Anh Tran
KeymasterHi,
This is just fixed. I will update the plugin today.
Anh Tran
KeymasterThe new version 4.7.1 fixes this bug. Please update.
November 19, 2015 at 4:34 PM in reply to: Text Fields dont save (MB Group 1.0.2) (Meta Box 4.7) #1768Anh Tran
KeymasterThat was my mistake :(. I forgot to update the data on the server. Everything seems fine now.
Thanks!
November 19, 2015 at 11:24 AM in reply to: Text Fields dont save (MB Group 1.0.2) (Meta Box 4.7) #1765Anh Tran
KeymasterDue to a change in Meta Box 4.7 with "attributes" param, the old code for Group doesn't work. I've just updated the extension to make it work with new version of Meta Box. Please update.
Thanks for reporting.
Anh Tran
KeymasterHi, sorry for this stupid bug :(. There's a fix for it on github and I will update the plugin right now.
-
AuthorPosts