New Landing How can we help? Themeforest Theme Support Uplift Different headers/footers for woocommerce/blog

Viewing 2 posts - 1 through 2 (of 2 total)
  • Posted in: Uplift
  • #310201
    zalguod
    Member
    Post count: 17

    I have a website with two main parts: a shop and a blog

    I would like to customize the headers and footers for each part. For instance, the shop will show in all pages information about shipping and contact/support, which is something that only brings noise to the articles in the blog.

    One solution is to have two installations of WordPress and a reverse proxy to put them in the same domain, but this create many problems like:
    1) Duplication of content (ex: images) and customizations (colors, configurations)
    2) The impossibility of including product widgets in the blog and blog posts widgets in the shop
    3) The impossibility of a cart in the blog
    4) The impossibility of a unified sitemaps.xml (at least not without some hacking)

    I would prefer to keep a single site and do some conditional include/replace in the code that renders the header/footer.

    Any ideas/workarounds/tips?

    #310228
    David Martin – Support
    Moderator
    Post count: 20834

    You would need to work with a developer for this. The WooCommerce conditionals are actually simple though.

    if ( is_woocommerce() ) {
    
    }

    Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included).

    if ( is_shop() ) {
    
    }

    Returns true when on the product archive page (shop).

    Ref: https://docs.woocommerce.com/document/conditional-tags/

    The blog conditionals would be as simple as check for the slug or page id for the blog page. Ex:

    if ( is_page( 42 ) ) {
    
    }

    // When Page 42 (ID) is being displayed.

    if ( is_page( 'Contact' ) ) {
    
    }

    // When the Page with a post_title of “Contact” is being displayed.

    Ref: https://developer.wordpress.org/reference/functions/is_page/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register