Custom Html field - output only 'std' content

Support General Custom Html field - output only 'std' contentResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26468
    wgstjfwgstjf
    Participant

    Hi all,

    I am attempting to break out of the 12 column grid to allow for 5 columns. My plan to achieve this is to wrap the relevant fields in a div with a custom class which I can then target with CSS and override the column widths.

    My issue is that my custom_html code below is wrapped in lots of rwmb-* containers. How can I get it to output just that code found within the 'std' key?

    
    // CUSTOM HTML
    array(
        'type' => 'custom_html',
        'std' => __( '<div class="fit-columns">', 'indigo-metaboxes' ),
        'id'   => 'fake_id_html',
    ),
    
    /* Various fields here... */
    
    // CUSTOM HTML
    array(
        'type' => 'custom_html',
        'std' => __( '</div>', 'indigo-metaboxes' ),
        'id'   => 'fake_id_html', 
    ),
    

    Cheers,

    Will

    #26482
    Long NguyenLong Nguyen
    Moderator

    Hi,

    It is impossible. If you add the HTML code in std settings without the closing tag </div>, it will be added automatically or break the layout.

    I recommend using the field group and wrap HTML code before and after the field appearance. Screenshot https://share.getcloudapp.com/mXu1wdy7.

    Or use two actions rwmb_before_{$meta_box_id} rwmb_after_{$meta_box_id} to wrap the meta box appearance inside the <div> tag.
    https://docs.metabox.io/actions/

    add_action( 'rwmb_before_{$meta_box_id}', function() {
        echo '<div id="your-id" class="your-class">';
    } );
    add_action( 'rwmb_after_{$meta_box_id}', function() {
        echo '</div>';
    } );
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.