Remove Store Title from WooCommerce Store Page Header

How to remove store title from header in wordpress; Hide store page title wordpress; Remove store title from woocommerce page; Wordpress remove header title from store page; How to hide store title in wordpress; Delete store page title wordpress; Woocommerce hide store title from header; Wordpress remove store page header title; How to delete store title in wordpress; Hide store header title wordpress;

Explanation

If you're looking to tidy up your WooCommerce store page by removing the store title from the header, this code snippet is just what you need.

Here's what it does:

  • First Function: It checks if you're on the shop page. If you are, it removes the product title from both the single product view and the product listings. This means your products won't display their titles in the usual spots.
  • Second Function: This one targets the page title itself. If you're on the shop page and within the main loop (where WordPress processes your posts), it returns an empty string instead of the usual title. This effectively hides the store page title.

By using these functions, your store page will have a cleaner look without the default titles cluttering the header. Just make sure to add this code to your theme's functions.php file or a custom plugin to keep things organized.

Code

<?php
// Function to remove the store title from the WooCommerce store page header
function wp_dudecom_remove_store_title() {
    if (is_shop()) {
        remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
        remove_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10);
    }
}
add_action('wp', 'wp_dudecom_remove_store_title');

// Function to remove the store title from the page title
function wp_dudecom_remove_store_page_title($title, $id = null) {
    if (is_shop() && in_the_loop()) {
        return '';
    }
    return $title;
}
add_filter('the_title', 'wp_dudecom_remove_store_page_title', 10, 2);
?>

Instructions

File Location: Add the following code to your theme's functions.php file or a custom plugin file.

Prerequisites:

  • Ensure WooCommerce is installed and activated on your WordPress site.

Implementation Steps:

  1. Access Your WordPress Dashboard: Log in to your WordPress admin panel.
  2. Navigate to Theme Editor:
    • Go to Appearance > Theme Editor.
    • In the right sidebar, find and click on functions.php under the Theme Files section.
  3. Add the Code:
    • Scroll to the bottom of the functions.php file.
    • Copy and paste the provided code snippet.
  4. Save Changes: Click the Update File button to save your changes.
  5. Verify:
    • Visit your WooCommerce shop page to ensure the store title is no longer displayed in the header.

If you encounter any issues or need further customization, consider reaching out to wp-dude.com for expert assistance.