Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Add product subheading underneath product title on archive page

$
0
0

Replies: 0

On the WooCommerce archives page, I want to add a subheading underneath each product’s title.

See this image for reference. Red boxes indicate subheading placement.

I tried to follow this guy, Add a custom field value below product title in WooCommerce archives pages, but the Custom Product Text Field is not available to me.

OceanWP has a subheading field, so I tried to change the code from the above linked post, and came up with this, but it doesn’t work:

add_action( 'woocommerce_after_shop_loop_item_title', 'subheading_display_below_title', 2 );
function subheading_display_below_title(){
    global $product;

    // Get the custom field value
    $subheading = get_post_meta( $product->get_id(), '_subheading', true );

    // Display
    if( ! empty($subheading) ){
        echo '<p class="subheading">'.$subheading.'</p>';
    }
}

How can I add my OceanWP product subheading beneath my product title on the product archive page?

Thank you.


Viewing all articles
Browse latest Browse all 59525

Trending Articles