Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1,216 through 1,230 (of 3,958 total)
  • Author
    Posts
  • in reply to: How to refer to cloneable single_image field? #14231
    Anh TranAnh Tran
    Keymaster

    Hi,

    Yes, you can display images as a gallery. Please try this code:

    $images = rwmb_meta( 'fotos', ['size' => 'thumbnail'] );
    echo '<div class="gallery">';
    foreach ( $images as $image ) {
        echo "<a href='{$image['full_url']}'><img src='{$image['url'}'></a>";
    }
    echo '</div>';
    Anh TranAnh Tran
    Keymaster

    Hi Brian,

    Solution 1: adding a text field for file name.

    You can do that by adding a text field into your meta box, or wrap the file_advanced and text field into a group, whatever convenient for you.

    Then outputting the file using code like below (this is for the case when the file and the text field are not in a group):

    $file = rwmb_meta( 'my_file' );
    $file = empty( $file ) ? null : reset( $file ); // Just get the first file.
    $title = rwmb_meta( 'my_file_title' );
    if ( is_array( $file ) ) {
        echo "<a href='{$file['url']}'>{$title}</a>";
    }

    If they're in a group, then you can do like this:

    $group = rwmb_meta( 'my_file_group' );
    $file_ids = isset( $group['file'] ) ? $group['file'] : null;
    $file_id = empty( $file_ids ) ? null : reset( $file_id );
    $file = RWMB_File_Field::file_info( $file_id );
    $title = isset( $group['title'] ) ? $group['title'] : '';
    if ( is_array( $file ) ) {
        echo "<a href='{$file['url']}'>{$title}</a>";
    }

    Solution 2: using a page builder

    If you use a page builder, like VC or Beaver Builder, you need to fetch the data of the file to use in the plugin. Meta Box stores attachment ID, not file URL.

    A quick solution for that is writing a shortcode to get file URL from the field, like this:

    add_shortcode( 'your_file_url', function( $atts ) {
        $file = rwmb_meta( 'my_file' );
        $file = empty( $file ) ? null : reset( $file );
    
        return empty( $file ) ? '' : wp_get_attachment_url( $file );
    } );

    And use shortcode [your_file_url] in your page builder module to get the file URL.

    Anh TranAnh Tran
    Keymaster

    Hi Brian,

    Thanks a lot for your info! I've figured it out and fixed on your site. The fix is also added in the plugin.

    in reply to: Hide/Show fields on select type #14199
    Anh TranAnh Tran
    Keymaster

    Hi Dave,

    It's normal. Since when you have multiple clones, it's impossible to know which clone is affected by the value of the selected field.

    Anh TranAnh Tran
    Keymaster

    Added password_strength parameter in the latest version 1.3.0, which indicates the minimum required password strength (can be very-weak, weak, medium or strong).

    in reply to: Big security issue ... #14189
    Anh TranAnh Tran
    Keymaster

    Fixed in the version 1.3.0. I see that we don't need the user_id parameter at all, since the form is only for the current user.

    Anh TranAnh Tran
    Keymaster

    This is done in this commit.

    Anh TranAnh Tran
    Keymaster

    Hi, all you need is just adding edit=true to the shortcode. The edit option is added in version 1.5.0.

    Anh TranAnh Tran
    Keymaster

    Can you please explain the "expiry" of a post type? What does that mean?

    Anh TranAnh Tran
    Keymaster

    What do you mean "as a filter"?

    Anh TranAnh Tran
    Keymaster

    Hi, please follow this solution: https://wordpress.stackexchange.com/q/134894/2051

    in reply to: WooCommerce Frontend Submission Form #14179
    Anh TranAnh Tran
    Keymaster

    Hi Barikom,

    Unfortunately, Meta Box doesn't handle all the WC form. The plugin works only with fields that are created by Meta Box.

    in reply to: Not showing on specified template #14178
    Anh TranAnh Tran
    Keymaster

    Hi Vladimir,

    Please set the template to the path of the template file, without .., e.g. templates/page-product-tech-template.php.

    in reply to: Use MB User Meta data in meta box #14177
    Anh TranAnh Tran
    Keymaster

    I'm not quite clear what do you mean by "Any possibility of this field or the identification code be automatic". I just understand that posts have a custom field the_user, which stores ID of the user you want to connect with. If you change the field ID from the_user to author, then simply change that text in the code. That's all.

    in reply to: Using other field content in name propertie. #14176
    Anh TranAnh Tran
    Keymaster

    Unfortunately, it's not possible.

Viewing 15 posts - 1,216 through 1,230 (of 3,958 total)