WordPress.org

Forums

WooCommerce - excelling eCommerce
[resolved] Remove page title? (10 posts)

  1. nyubbie
    Member
    Posted 2 years ago #

    How do I remove the page-title element that WooCommerce generates with a remove_action filter?

    I'm trying remove_action( 'woocommerce_page_title', '', 20, 0 ); but it isn't working.

    http://wordpress.org/extend/plugins/woocommerce/

  2. Coen Jacobs
    Member
    Posted 2 years ago #

    This page title isn't added through an action, so you can't remove it using the remove_action() function. I think the title you are looking for is located in the archive-product.php template file (although this applies to pretty much all template files) and you can override that template via your theme.

    Please read our documentation on template structure and overriding templates for more information about how to do that.

  3. nyubbie
    Member
    Posted 2 years ago #

    I went into archive-product.php, and removed <h1 class="page-title"><?php woocommerce_page_title(); ?></h1>.

    I was hoping I could use the remove_action function, but I guess the title wasn't exactly designed to be hooked and unhooked.

    Why is it like that, though? There are a lot of functions that use hooks, while some of them need to be removed manually from their respective templates... isn't that a bit confusing?

  4. Coen Jacobs
    Member
    Posted 2 years ago #

    Please note that you should not change files in the WooCommerce plugin itself, but use the template overrides to protect your changes for when you update the plugin. The template overrides you do in your theme are update safe.

    The plugin is a moving process and we're always open to changes. You are welcome to propose a change via our GitHub repository, if you like. Please do be as detailed as possible about your reasons to do this change, if you do.

  5. nyubbie
    Member
    Posted 2 years ago #

    yeah. I put the changes into a template as directed in the docs...

    thanks for your help! its not that often that a developer comes online to help in the support section.

  6. nyubbie
    Member
    Posted 2 years ago #

    ...and for proposing a change -- do I need to provide the code as well? or is it optional?

  7. Coen Jacobs
    Member
    Posted 2 years ago #

    You're welcome, happy to help.

    Well, if you want us to seriously consider it, you'll have to be very detailed in your description on what and why (especially the 'why' part is important) you want changed, providing the code is optional (but allowed :)).

  8. aj218
    Member
    Posted 1 year ago #

    Can somebody help me in customizing this title based on the category and subcategory that user has selected from the menu?
    For example, user want to see the products with brand name "sony", where brand is category and sony is sub category, then title should be like "Product look up by Brand: Sony"
    Similarly for prices it should be like "Product Look up by Price: $100-$200", where price is category and $100-$200 is subcategory.
    I know it will be using "if loop" but I'm kinda new here so don't know the exact code to customize.

  9. jcmago
    Member
    Posted 1 year ago #

    You can find woocommerce-template.php under wp-content/plugins/woocommerce

    The line of code you're looking for from this thread (providing you havent altered your woocommerce-template) is line 43

    That's all

    enjoy Folks

  10. polarvortex
    Member
    Posted 1 year ago #

    This will work:

    add_filter( 'woocommerce_page_title', 'woo_shop_page_title');

    function woo_shop_page_title( $page_title ) {

    if( 'Shop' == $page_title) {
    return "My new title";
    }
    }

    Src: http://www.wpexplorer.com/best-woocommerce-snippets/ [#13]

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic