Forum Replies Created
-
AuthorPosts
-
March 15, 2022 at 1:11 PM in reply to: Tutorial should include custom function for get_avatar_url, too #34521
Long Nguyen
ModeratorHi,
Thanks for your feedback.
Some page builders like Elementor use the WordPress function
get_avatar_url()to get the avatar URL instead of getting HTML code to show the avatar as the functionget_avatar()return. I will update the article to cover this case.March 14, 2022 at 10:34 PM in reply to: ✅Content of custom field saved on a page but not when the page is the frontpage #34516Long Nguyen
ModeratorHi,
Can you please deactivate all plugins except Meta Box, MB AIO, switch to the standard theme of WordPress (Twenty TwentyTwo), and recheck this issue?
Long Nguyen
ModeratorHi Nick,
You can access the block ID via
$attributes['id']in the callback function or template.
https://docs.metabox.io/extensions/mb-blocks/#render_callbackAnd please notice that the ID of the block changes every time updating the post or refresh the editing page, be careful if you use the ID to style the element or use it as a selector.
In your case, I will inform the development team to consider supporting inline script in the template to execute JS functions.
Long Nguyen
ModeratorHi Cees,
Use brackets, a pair of marks
[], when you have an array of values without keys like this
[value 1, value 2, value 3]Use curly brackets, a pair of marks
{}, when you have an object or array with keys and values like this
{a: 'A', key1: 'value 1', key2: 'value 2'}
keyalso does not need to wrap in the single quotes.Refer to this topic https://support.metabox.io/topic/displaying-two-cpts-in-custom-taxonomy-term/
March 13, 2022 at 9:56 PM in reply to: Could Meta Box help me build Categories specific to each User? #34504Long Nguyen
ModeratorHi,
Meta Box does not support creating a user specific category like that. You can create a custom code to do that. After creating a post and a category selected, update the term meta with that user ID. Then exclude this category from the next form by using setting
query_argsof the field taxonomy.
https://docs.metabox.io/fields/taxonomy/March 12, 2022 at 6:23 AM in reply to: ℹ️REQUEST: Frontend Submision > User Posts Dashboard > custom fields #34493Long Nguyen
ModeratorHi,
The extension MB Frontend Submission does not support options to customize the user dashboard. If you are familiar with coding, you can follow this topic https://support.metabox.io/topic/duplicate-dashboard-shortcode/
to know how to create your own dashboard.Long Nguyen
ModeratorHi,
Please try to re-save the permalink settings and re-check this issue.
Long Nguyen
ModeratorHi,
You can follow this documentation to know how to use Twig
https://docs.metabox.io/extensions/mb-views/#twigand combine it with the proxy
mbto call a PHP function in View
https://docs.metabox.io/extensions/mb-views/#running-php-functionsFor example:
$terms = get_the_terms( $post->ID, 'portfolio-type'); $background_image = get_term_meta( $terms[0]->term_id, 'upload_portfolio_thumbnail', true );{% set terms = mb.get_the_terms( post.ID, 'portfolio-type' ) %} {% set background_image = mb.get_term_meta( terms[0].term_id, 'upload_portfolio_thumbnail', true ) %}and so on.
Long Nguyen
ModeratorHi Daniel,
You can add more field group (meta box) ID to the frontend submission shortcode to show them on the frontend. For example:
[mb_frontend_form id="meta-box-id1,meta-box-id2,meta-box-id3" post_fields="title,content"]Long Nguyen
ModeratorHi,
No, it is not possible. The featured image saved the image ID while the field oEmbed saved the media URL in the database. You can replace the code that outputs the featured image with the helper function to output the custom field value.
https://docs.metabox.io/fields/oembed/#template-usageMarch 11, 2022 at 1:18 PM in reply to: ✅Change color style for posts which have a "CUSTOM taxonomy" #34473Long Nguyen
ModeratorHi,
On the single post, please change the code to get the background color to this one
function astr_child_output_frontend() { If ( ! is_single() ) { return; } $post_id = get_queried_object_id(); $term_colors = get_the_terms( $post_id, 'post-style-color' ); $background_color = rwmb_meta( 'background_color_taxonomy', ['object_type' => 'term'], $term_colors[0]->term_id ); if ( ! $background_color ) { return; } echo ' <!-- custom style taxonomy --> <style> .single-post { background-color: ' . $background_color . '; } </style>'; } add_action( 'wp_head', 'astr_child_output_frontend' );Long Nguyen
ModeratorHi,
You can create the condition to check the field value before showing the post, like this
{% set posts = mb.get_posts( args ) %} {% for post in posts %} <!-- create your condition before showing the post --> {% if post.event_with_datum == 'No' %} <div class="event_card-row"> <div class="event_card-date"> {{ post.event_startdatum | date( 'd F Y' ) }} </div> <div class="event_card-row-title-wrapper"> <h4 class="event_card-row-title"> {{ post.post_title }} </h4> </div> </div> {%else%} something here {% endif %} {% endfor %}March 11, 2022 at 12:44 PM in reply to: How can I retrieve value from a radio field in MB Field? #34471Long Nguyen
ModeratorHi,
Please use the helper function
rwmb_meta()to get the field value in the custom query. As I wrote down in the documentation, if you use a custom query, the field in the Insert Field tab will not work as designed.
https://docs.metabox.io/extensions/mb-views/#main-queryLong Nguyen
ModeratorHi,
I do not see that issue on my end, screen record https://monosnap.com/file/85XqBOarEEKQJ4UGh112zfTDkTguY1
It might be the theme issue, you can try to switch to the standard theme of WordPress (Twenty Twenty Two) and re-check this.
March 11, 2022 at 12:23 PM in reply to: How do I populate a relationship value based on the related post they select #34469Long Nguyen
ModeratorHi,
Since you can use the relationships on the frontend with the extension MB Frontend Submission, no need to use the field
postto select the relation posts. -
AuthorPosts