Is it possible to suppress the title from showing?

Support General Is it possible to suppress the title from showing?Resolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #22825
    MartinMartin
    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.

    #22830
    Long NguyenLong 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
    MartinMartin
    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 NguyenLong 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
    MartinMartin
    Participant

    Perfect. Thanks Long.

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