Advertisement
fahimmurshed

Custom field - Prodcut sub title

Aug 16th, 2021
1,779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. //Display the custom field on SINGLE product page below the title in ASTRA
  2.  
  3. add_action( 'astra_woo_single_title_after', 'subheading_display_below_title', 2 );
  4. function subheading_display_below_title(){
  5.     global $product;
  6.  
  7.     // Get the custom field value
  8.     $subheading = get_post_meta( $product->get_id(), 'product_subheading', true );
  9.  
  10.     // Display
  11.     if( ! empty($subheading) ){
  12.         echo '<p class="subheading">'.$subheading.'</p>';
  13.     }
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement