• Resolved ahmadtalal0786

    (@ahmadtalal0786)


    Hello,
    Your plugin is amazing and very easy to use.
    I have a simple question. Is there any hook or is it possible that i can show the title of the product in the description for better SEO. I have hundreds of products and I want to show the title as an H2 at the beginning of the product long description. I dont want to write the title manually becuase its a tedious process. Is there any way or php code that i can add in fucntion.php to do it dynamically and show the title of the product as an H2 in the first line of the product long description.
    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @ahmadtalal0786

    You can place below code snippet in your currently active theme’s functions.php file.

    Code Snippet:

    function my_the_content_filter( $content ) {
    
    	if ( get_post_type() == "product" ) {
    		wc_get_template( 'single-product/title.php' );
    		
    		/*// OR
    		$title = "<h2>". get_the_title() . "</h2>";
    		$content = $title.$content;*/
    	}
      
      return $content;
    }
    add_filter( 'the_content', 'my_the_content_filter', 10, 1 );

    Please let me know if the above code snippet fulfilled your requirements or not.

    Plugin Support Fernando a11n

    (@fhaps)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show Title at every description’ is closed to new replies.