Home Forums Trusted Pro Removing header image (and page title) on product archive pages.

Tagged: , ,

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #6398
    Adri Oosterwijk
    Participant

    Hi Andy,

    Question: I want to remove the header images on the product archive pages. I succeed to some extend.

    When editing the shop page, scroll down and set another option for a custom header it works for the shop page, the returned archive when performing a search but not when I want to display a product catgory.

    For the shop page and the search result pages it is using the template: archive-product.php but when I want to display a category the taxonomy-product.cat.php template is used. Strange thing is that in the latter template archive-product.php is called.

    Please advice….

    Thanks in advance.

    Adri

    #6405
    Adri Oosterwijk
    Participant

    I noticed that the above-described method not functions when I try to do the same on a (WPML) translated page (product archive). The editor for the header area differs in the English and the Dutch page. I do hope and trust you have a solution.

    See screenshots.

    English header area

    Dutch header area

    English product page

    Dutch product page

    #6410
    Andy
    Keymaster

    For the product category, you need to edit that category if you want to make changes to it. Editing the ‘shop’ page will see your changes only on the ‘shop’ page.

    Go to ‘Products’ > ‘Categories’ and edit the category you want. The categories, tags etc. have the same header options as posts/pages.

    #6411
    Andy
    Keymaster

    If I understand multilingual plugins such as WPML correctly, when you create a version of a page (or category) in a different language, it creates a new extra version of that page.

    So for example, you have a page in English, then you create a translated version in Dutch. There are now two versions of that page, one English and another Dutch, and WPML will show either English or Dutch version of that page depending on what the visitor has selected as their preferred language for your website.

    So now of course any changes you make to the English version of that page will NOT update to the Dutch version of that page and vice-versa, otherwise there would be no point having the two different language versions of that page, because they are expected to have different content (of course it could be the “same” content just translated but different content nonetheless).

    Hope this helps, and if you have any questions about WPML I would recommend that you check out the WPML documentation or ask the support department of the WPML plugin as they will be able answer questions about their plugin much more accurately.

    #6413
    Adri Oosterwijk
    Participant

    Hi Andy, thanks for your reply.

    The Categories I can manage this way because there are only 31 of them in 2 languages (that makes 62). That is a one time operation.

    The tags is a different story. At this moment (with approx. 1.000 products) I have already 2.280 distinct tags in English and 2.280 tags in Dutch and more to come when more products and/or languages are added.

    As this is very time-consuming to edit all categories and tags manually I am hoping for a better solution.

    A function for in my functions.php perhaps? That could (should) solve my multilingual issue also.

    What I meant was that a translated page exists ‘on its own’ like you said. The strange thing however is when I try to edit the translated page (which is possible) with the normal page editor, I’m not able to do so because I’m presented with a different interface as shown in the screenshots.

    To ask WPML for help is useless because the Trusted Pro theme is not on their compatibility list (yet). They simply don’t know what to do.

    Again, I do hope you are able to help me out with a code solution that covers it all.

    I do not mention to extend the theme with this option as I know that there are not many customers who want this. As I have a very big amount of products +1000 right now and thousands more to come I need to have as much screen real estate as possible.

    Please help…..

    #6414
    Andy
    Keymaster

    Ah right, thanks for clarifying.

    So that I completely understand what you want to achieve, you basically want all the product tag archives to display an empty custom header?

    #6415
    Adri Oosterwijk
    Participant

    Yes…. and more

    It basically boils down to all archives which are displaying products in all languages.

    • Product archives (shop page) -> archive-product.php
    • Product search results -> archive-product.php
    • Product categories -> taxonomy-product_cat.php
    • Product tags -> taxonomy-product_tag.php
    • Are there more? I need it on those too. 🙂

    Note that it has to be in all languages (existing and new to add).

    As always, thanks for your help.

    #6416
    Andy
    Keymaster

    Okay, just so you know, don’t look in the archive-product.php and taxonomy… files.

    The header image and page title area in this theme is handled by the theme’s header.php file. Look at the end of that file and you will see reference to the trusted_header_title() and trusted_custom_header_title() functions. The custom header setting for a particular page, category, tag etc. determines which of these two functions is to run.

    It may be that you can use conditional logic to tell all product archives to run an empty custom header. Check out WooCommerce’s conditional tags for the appropriate one(s) to use.

    #6417
    Adri Oosterwijk
    Participant

    Spending the last couple of hours to find a solution (following your advice) I noticed in the WooCommerce docs a partial solution.

    I wrapped the call for the header in an if statement:

    ‘ if (!is_woocommerce()){
    if ($trusted_custom_header) {
    trusted_custom_header_title($trusted_this_id);
    } else {
    trusted_header_title();
    }
    }’

    The header is disappeared but also is the <div class=”container clearfix”> changed to <div id=”content” class=”site-content clearfix”>

    The result is that the page becomes full with (no container of 1160px and the content is shifted to the upper left corner, partially hidden by the (so to say) header bar.

    I could not find a way to fix this myself so, again, I need your help. (Sorry)

     

    #6418
    Adri Oosterwijk
    Participant

    Mmm…. I see that I’ve given you wrong info. I’m totally confused. Forget the part about the missing (or changed) div. Really don’t know what is happening.

    #6419
    Adri Oosterwijk
    Participant

    Herewith two screenshots:

    one with the header image in place (original theme) and one with the !is_woocommerce() conditional invoked. Please be so kind to help me out here. Apparently, the page structure has changed also to an extent that the page is messed up.

    #6420
    Andy
    Keymaster

    By using the if (!is_woocommerce()){ conditional, you are saying that any page that does NOT use a WooCommerce template should follow this rule.

    Replace your PHP code with this:

    if ( is_product_category() || is_product_tag() ) {
        trusted_custom_header_title( '27' );
    } else {
        if ( $trusted_custom_header ) {
            trusted_custom_header_title( $trusted_this_id );
        } else {
            trusted_header_title();
        }
    }

    This will run the empty custom header on all product category archive pages OR product tag archive pages.

    Change the number ’27’ to an actual page ID of a page that is set to display an empty custom header, or create such a page specifically for this purpose. You won’t be showing this page on site, it is only for the purposes of using it’s page ID in this code.

    #6421
    Adri Oosterwijk
    Participant

    That’s absolutely great! Thanks. It works for the category and tags pages in English and Dutch.

    I added || is_shop() to the conditional myself to get it working in the Dutch shop and search result pages as well. Thank you so much, you made my day!

     

    #6564
    Adri Oosterwijk
    Participant

    Resolved! Great Support! Thanks.

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Removing header image (and page title) on product archive pages.’ is closed to new replies.