black friday sale

Custom Fields
Re-Envisioned
Support General Is it possible to suppress the title from showing?

  • Creator
    Topic
  • #22825
    Resolved Martin
    Participant

    I’m looking for a way to stop the title of a Custom Fields form from displaying. If I leave the title blank then the words Meta Box Title show in the page as a title next to the form. I don’t want anything to show at all there. The page the form is displayed on already has it’s own title etc.

    Ideally I’m guessing there should be a setting that suppresses it.

    Or is this something I should be looking for in the WP theme? I’m using Twenty Twenty for now.

    Thanks.

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

    Hi Martin,

    The text “Meta Box Title” is the default title which displays when the meta box has an empty title. If you use the code to show the meta box and fields, leave the title with a space to remove it.

    $meta_boxes[] = array(
            'id'             => 'meta-box-id',
            'title'          => ' ',
            'post_types'         => 'post_type',
    ...

    Or use this custom CSS code in the admin area to hide it.

    #meta-box-id h2.hndle {
        opacity: 0;
    }

    See https://share.getcloudapp.com/12urWRyB.

    Or use the meta box setting 'style' => 'seamless' remove the wrapper box and display fields seamlessly. Follow the documentation https://docs.metabox.io/creating-meta-boxes/#meta-box-settings.

    #22833
    Martin
    Participant

    Thanks Long.

    I’m probably being a bit dense but where do I put any of these in Builder? For instance I can see the line below in the code tab but that’s not editable.
    'title' => esc_html__( 'My Title', 'text-domain' ),

    And where would I put the ‘style’ => ‘seamless’ setting? I see an option for this if the Show For is set to Posts but my form is for Users and the whole Option section of Settings is removed when I select Users. I tried it under Show For Posts which looked how I wanted but I need it to do the same for Users.

    #22848
    Long Nguyen
    Moderator

    Hi Martin,

    To remove the meta box title in the user profile page, please add this code to the file functions.php in the theme folder or use the plugin Code Snippets.

    add_action( 'init', function() {
        remove_all_actions( 'rwmb_before_metaboxID' );
    }, 99 );

    Change metaboxID with your meta box ID, see https://share.getcloudapp.com/L1uQqRp4.

    #22895
    Martin
    Participant

    Perfect. Thanks Long.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.