Custom Fields
Re-Envisioned
Support General Custom Html field – output only ‘std’ content

  • Creator
    Topic
  • #26468
    wgstjf
    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

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #26482
    Long 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 1 replies (of 1 total)
  • You must be logged in to reply to this topic.