• Resolved thelyall

    (@thelyall)


    I am building a basic WooCommerce site using the built-in theme ‘exoplanet’ and I have the following problem:

    – Shop home page has the main title at the top which is correct
    – Categories have the category name as the main title at the top which is correct
    – Sub-Categories have the sub-category name as the main title at the top which is correct
    – BUT when you click through to a product, it has the main shop home page title at the top

    Please can you tell me how I can get it to display the product name as the title at the top of the page? I haven’t been able to find an answer to this elsewhere.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi, we are the authors of the Exoplanet theme and are happy to offer help if we can.

    The Exoplanet theme doesn’t change how WooCommerce displays the single product title, so the title is displayed in the standard WooCommerce postition to the right of the product image, and the fallback ‘Shop’ title in the header.

    This can be changed using some custom coding in a child theme.

    How comfortable are you with using a child theme and adding your own PHP functions to a child theme?

    Thread Starter thelyall

    (@thelyall)

    Thanks for the quick reply. I’m quite comfortable updating pages in a child theme (I’ve been updating the functions page and I have updated some of the front end pages in other projects so should hopefully be ok). I have just created the child theme successfully.

    • This reply was modified 6 years, 3 months ago by thelyall. Reason: Added successful creation of child theme

    Add the following code to the functions.php file of your child theme.

    /* REMOVE SINGLE PRODUCT TITLE FROM PRODUCT SUMMARY AREA */
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
    
    /* ADD SINGLE PRODUCT TITLE TO PAGE HEADER AREA */
    function exoplanet_wc_product_title( $page_title ) {
    	if ( is_product() ) {
    		return the_title();
    	} else {
    		return $page_title;
    	}
    }
    add_filter('woocommerce_page_title', 'exoplanet_wc_product_title');

    There are two parts to this and the /*COMMENTS*/ are there to describe what does what and can be removed if you want.

    Thread Starter thelyall

    (@thelyall)

    That’s absolutely perfect! Thank you so much ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Incorrect title on product page?’ is closed to new replies.