Adding a small 1-2 line subheading just below 'Add Details'

Hello, I just want to add a small subheading text (line 1-2 lines) just below ‘Add details’ section to give some information about what details are they entering. How can it be done?

Hi @ishcap619,

It might not be the best way to do it, but I’ve tested it and it works:

You can add the following code via a Code Snippets plugin for easy maintainence.

// Insert a compact, styled notice directly under the H1 (nested under page_container child).
add_filter( 'hivepress/v1/templates/listing_submit_details_page', function( $template ) {

    if ( empty( $template['blocks']['page_container']['blocks'] ) || ! is_array( $template['blocks']['page_container']['blocks'] ) ) {
        return $template;
    }

    $siblings   =& $template['blocks']['page_container']['blocks'];
    $notice_key  = 'custom_details_notice';

    foreach ( $siblings as $key => $block ) {
        if ( empty( $block['blocks'] ) || ! is_array( $block['blocks'] ) ) {
            continue;
        }

        foreach ( $block['blocks'] as $ckey => $cblock ) {
            $ctype  = $cblock['type'] ?? '';
            $corder = isset( $cblock['_order'] ) ? (int) $cblock['_order'] : 10;

            if ( $ctype === 'page_title' || stripos( $ckey, 'title' ) !== false || stripos( $ckey, 'heading' ) !== false ) {
                $child_parent =& $siblings[ $key ]['blocks'];

                if ( ! isset( $child_parent[ $notice_key ] ) ) {
                    $child_parent[ $notice_key ] = [
                        'type'    => 'content',
                        'content' =>
                            // Reduce H1 margin just for this page
                            '<style>.hp-page__title{margin-bottom:8px !important;}</style>' .
                            '<div id="custom-details-note" style="margin-top:0;padding:12px 14px;border:1px solid #e5e7eb;border-radius:8px;background:#f0f8ff;line-height:1.45;">
                                <strong>Note:</strong> Please make sure you fill out all required details before submitting your listing.<br>
                            </div><br>',
                        '_order'  => $corder + 1, // directly after the title
                    ];
                }

                return $template;
            }
        }
    }

    return $template;
}, 1000 );

You can customise the message to your liking, and try changing the order number to adjust the positioning, if need be.

I hope this helps!

Cheers,
Chris :victory_hand:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.