• Resolved thePixelPixie

    (@yourbusybee)


    I built the theme. I’m just not sure what I’ve done wrong with the header that it’s not showing the correct page title. I’m assuming I need some sort of conditional in my header-shop.php? Or my header.php? I’m just not sure.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hi,

    If your WooCommerce shop page is not displaying the correct page title in your custom-built theme, you can indeed use conditionals in your header.php or header-shop.php file to ensure the correct title is displayed.

    Here’s how you can do it:

    1. Identify the Shop Page:
    • In WooCommerce, the shop page is usually assigned in the WooCommerce settings. You can find this under WooCommerce > Settings > Products > General > Shop Page.
    • Note the ID of the shop page.
    1. Edit Your header.php or header-shop.php:
    • In your theme files, open header.php or header-shop.php, whichever is responsible for displaying the header on your shop page.
    1. Add a Conditional Check:
    • Use a conditional statement to check if the current page is the shop page by comparing its ID with the shop page ID you noted earlier.
       <?php if (is_page(YOUR_SHOP_PAGE_ID_HERE)) : ?>
          <h1>Your Shop Title</h1>
       <?php else : ?>
          <h1><?php the_title(); ?></h1>
       <?php endif; ?>

    Replace YOUR_SHOP_PAGE_ID_HERE with the actual ID of your shop page.

    1. Save the File:
    • Save the changes to your header.php or header-shop.php file.
    1. Clear Caches:
    • If you’re using any caching plugins or server-side caching, clear the cache.
    1. Test:
    • Visit your shop page and ensure that it displays the correct title.

    By using this conditional statement, you’re checking if the current page is the shop page. If it is, you display “Your Shop Title,” and if it’s any other page, it will display the default page title using the_title(). This should resolve the issue of displaying the correct page title on your shop page.

Viewing 1 replies (of 1 total)
  • The topic ‘Shop page title shows first product name’ is closed to new replies.