Forum Replies Created
-
AuthorPosts
-
December 5, 2015 at 3:42 PM in reply to: Can't use wp_query "meta_key" parameter to filter posts #1868
Anh Tran
KeymasterI mean getting the ID of the post you want to get value for. Inside the loop, you setup global post object and the helper function auto takes its ID. But outside the loop, the helper function doesn't know which post object to take ID, and thus it might output the wrong value.
I'm not sure if that's the case, cause the situation is not 100% clear. That are just my thoughts.
Anh Tran
KeymasterIt seems the version of group extension is old. Please update the Group extension to the latest version 1.0.3 which has a fix for this.
Anh Tran
KeymasterHi Johann, I think yes :), the code is correct.
Anh Tran
KeymasterHmm, I see. So you set a fixed template for the front page and don't use Page template at all.
My suggestion is making the front page a normal page template (so it won't be hardcoded) -
template-front-page.phpfor example and use the extension to show meta box for this page template only:'show' => array( 'template' => array( 'template-front-page.php' ), )Anh Tran
KeymasterLet me check it again and get back to you. The 4.7 has a new feature with custom attributes, including the meta value. Maybe it *thinks* the value is empty and doesn't show it.
Anh Tran
KeymasterHi Johann,
For group, the value of a group is always an array. If it's cloneable, then the value is always array of arrays (2 level depth array), even when it's empty. So, for group, you should check the subvalue as well, not just
emptyon the group value.For other fields, I can't replicate the bug. There is also 1 open pull request for similar bug on Github (for oembed field), but I can't make the same bug:
https://github.com/rilwis/meta-box/pull/703
Do you see the same problem? Can you post your code?
Anh Tran
KeymasterHi Saul,
I think it's fixed in the development version on Github:
https://github.com/rilwis/meta-box/blob/master/inc/fields/post.php#L142
I will update the plugin soon so it's available on WordPress.org as well.
Anh Tran
KeymasterIn your shortcode, you use a custom query but you don't reset the query after outputting HTML. That makes the global
$postobject isn't reseted and contains wrong value of the current post. Thus, therwmb_metashortcode can't get the correct value.Best way to resolve this is adding
wp_reset_postdata()after your query and try again.Anh Tran
KeymasterHi Johann,
1. You mean if the page is set as the static front page in Settings | Reading? Or just front page template?
If front page template, we already have that with the option 'template'.
2. We have options to reorder clonable fields. Just add
'sort_clone' => trueto the field and you will see :). It works for both normal fields and group.Anh Tran
KeymasterHi Johann,
It's not possible to do that. The extension only supports cloning the whole group, not sub-fields.
November 30, 2015 at 2:14 PM in reply to: Can't use wp_query "meta_key" parameter to filter posts #1825Anh 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,
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
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.
-
AuthorPosts