Custom Fields
Re-Envisioned
Support Meta Box – Beaver Themer Integrator Beaver Builder Conditional Logic Help

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #18834
    Long Nguyen
    Moderator

    Hi,

    The right ID of the field is $prefix . 'field_id', could you please check the $prefix variable above the code if it has any string? Or share the code that you use to create the field.

    #18837

    Hi Long,
    Thanks for writing. I have been putting the prefix into the beaver themer conditional logic fields. Here is a video showing my process. Perhaps I’m missing something.

    https://share.getcloudapp.com/2NuB49de

    Thanks

    Here is the code for one of the fields:

    array (
    ‘id’ => $prefix . ‘text_gm0xjjhubsv’,
    ‘type’ => ‘text’,
    ‘name’ => esc_html__( ‘Speaker Name’, ‘text-domain’ ),
    ‘tab’ => ‘tab_nqd2avvq8wd’,
    ),

    #18845
    Long Nguyen
    Moderator

    Hi,

    Let’s see the simple custom field for the post

    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $prefix = 'your_prefix_'; // check your prefix here
    
        $meta_boxes[] = array (
            'title' => esc_html__( 'Text', 'text-domain' ),
            'id' => 'text',
            'post_types' => array(
                0 => 'post',
            ),
            'context' => 'normal',
            'priority' => 'high',
            'fields' => array(
                array (
                    'id' => $prefix . 'text_field',
                    'type' => 'text',
                    'name' => esc_html__( 'Text Field', 'text-domain' ),
                ),
            ),
        );
    
        return $meta_boxes;
    }

    after connect to show the Meta Box Field, you can check the conditional logic with the field id your_prefix_text_field. I’ve created a screen record for this case https://cl.ly/1210e564df6f

    #19415
    hartsook@gmail.com
    Participant

    I have a similar problem trying to use BB Conditional Logic to hide a column if the custom avatar is not set (https://metabox.io/create-custom-avatar/?fbclid=IwAR3I1M2s71PFAQgNdhAk5tuAXqhyKU46WP-qJZvOVKBxKBbjdYAAB4vX5u4 )

    I’m editing the column where the Post Author Image is placed using Themer, and then setting Conditional Logic for the column to show if:
    $prefix . ‘custom_avatar’
    is set

    But even when the custom_avatar is set the column is still hidden.

    Any ideas?

    #19420
    Long Nguyen
    Moderator

    @hartsook

    The $prefix is the variable in the code, please use its value when you add the field ID to conditional logic. If you use the Builder to create the field, click to the tab Code to get it.

    For this case, it’s empty so the field ID is custom_avatar.

    Another example when creating the field with the code https://cl.ly/1a3053aad345
    the field ID to use in this case is settings_test_single_id

    Hope that makes sense.

    #19421

    yes, the way that Long showed me is that i was missing the first prefix for the filter. You have to put both in the conditional logic field. https://share.getcloudapp.com/mXuBKPNG

    in the picture the highlighted field is the first prefix. Both prefixes need to be together for it to work.

    #19462
    hartsook@gmail.com
    Participant

    Now one more step. I actually want to hide the column the image is in if NEITHER the gravatar nor the custom_avatar image is set. If the author has a gravatar and not a custom_avatar then show, if the author has a custom_avatar then show, but if no image is set, hide the column using the Themer conditional logic.

    Which trigger do I use and what would the key be if that is required?

    Trying to understand the specific case here as well as the generalization so I can use the conditional logic in other places like an author archive page for example.

    #19468
    Long Nguyen
    Moderator

    @hartsook

    Because WordPress gets the user profile picture from Gravatar by ID or email and not save any image information to the database so we can only check the condition of custom avatar which is created by Meta Box and save to the database as a user meta with Beaver Builder.

    You can follow the documentation
    https://developer.wordpress.org/reference/functions/get_avatar/
    https://developer.wordpress.org/reference/functions/get_avatar_data/

    to check both conditions: available Gravatar and available custom avatar with coding.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
grid gear info copy caret-up caret-down trash