Home Forums Basel support forum Product Page – Page Title

Product Page – Page Title

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #183040

    Optilink
    Participant

    Hi,

    Is there a way to fix the page title text in my shop page? I have the category menu enabled and it shows under the page title but when I click on a category the title changes to the active category page but I want that to always be the same as my shop page.

    Also, I want to show the category menu on the page title on my product page. I used the below from one of the other threads – can you tell me what needs to change to show the category menu under the page title please?

    add_action( ‘basel_after_header’, ‘basel_page_title’, 10 );

    function basel_page_title() {
    global $wp_query, $post;

    // Remove page title for dokan store list page

    if( function_exists( ‘dokan_is_store_page’ ) && dokan_is_store_page() ) {
    return ”;
    }

    $page_id = 0;

    $disable = false;
    $page_title = true;
    $breadcrumbs = basel_get_opt( ‘breadcrumbs’ );

    $image = ”;

    $style = ”;

    $page_for_posts = get_option( ‘page_for_posts’ );
    $page_for_shop = get_option( ‘woocommerce_shop_page_id’ );
    $page_for_projects = basel_tpl2id( ‘portfolio.php’ );

    $title_class = ‘page-title-‘;

    $title_color = $title_type = $title_size = ‘default’;

    // Get default styles from Options Panel
    $title_design = basel_get_opt( ‘page-title-design’ );

    $title_size = basel_get_opt( ‘page-title-size’ );

    $title_color = basel_get_opt( ‘page-title-color’ );

    $shop_title = basel_get_opt( ‘shop_title’ );
    $shop_categories = basel_get_opt( ‘shop_categories’ );

    // Set here page ID. Will be used to get custom value from metabox of specific PAGE | BLOG PAGE | SHOP PAGE.
    $page_id = basel_page_ID();

    if( $page_id != 0 ) {
    // Get meta value for specific page id
    $disable = get_post_meta( $page_id, ‘_basel_title_off’, true );

    $image = get_post_meta( $page_id, ‘_basel_title_image’, true );

    $custom_title_color = get_post_meta( $page_id, ‘_basel_title_color’, true );
    $custom_title_bg_color = get_post_meta( $page_id, ‘_basel_title_bg_color’, true );

    if( $image != ” ) {
    $style .= “background-image: url(” . $image . “);”;
    }

    if( $custom_title_bg_color != ” ) {
    $style .= “background-color: ” . $custom_title_bg_color . “;”;
    }

    if( $custom_title_color != ” && $custom_title_color != ‘default’ ) {
    $title_color = $custom_title_color;
    }
    }

    if( $title_design == ‘disable’ ) $page_title = false;

    if( ! $page_title && ! $breadcrumbs ) $disable = true;

    if( $disable && ! is_front_page() ) return;

    $title_class .= $title_type;
    $title_class .= ‘ title-size-‘ . $title_size;
    $title_class .= ‘ color-scheme-‘ . $title_color;
    $title_class .= ‘ title-design-‘ . $title_design;

    // Heading for pages
    if( is_singular( ‘page’ ) && ( ! $page_for_posts || ! is_page( $page_for_posts ) ) ):
    $title = get_the_title();

    ?>
    <div class=”page-title <?php echo esc_attr( $title_class ); ?>” style=”<?php echo esc_attr( $style ); ?>”>
    <div class=”container”>
    <header class=”entry-header”>
    <?php if( $page_title ): ?><h1 class=”entry-title”><?php echo esc_html( $title ); ?></h1><?php endif; ?>
    <?php if( $breadcrumbs ) basel_breadcrumbs(); ?>
    </header><!– .entry-header –>
    </div>
    </div>
    <?php
    return;
    endif;

    // Heading for blog and archives
    if( is_home() || is_singular( ‘post’ ) || is_search() || is_tag() || is_category() || is_date() || is_author() ):

    $title = ( ! empty( $page_for_posts ) ) ? get_the_title( $page_for_posts ) : esc_html__( ‘Blog’, ‘basel’ );

    if( is_tag() ) {
    $title = esc_html__( ‘Tag Archives: ‘, ‘basel’) . single_tag_title( ”, false ) ;
    }

    if( is_category() ) {
    $title = ‘<span>’ . single_cat_title( ”, false ) . ‘</span>’; //esc_html__( ‘Category Archives: ‘, ‘basel’) .
    }

    if( is_date() ) {
    if ( is_day() ) :
    $title = esc_html__( ‘Daily Archives: ‘, ‘basel’) . get_the_date();
    elseif ( is_month() ) :
    $title = esc_html__( ‘Monthly Archives: ‘, ‘basel’) . get_the_date( _x( ‘F Y’, ‘monthly archives date format’, ‘basel’ ) );
    elseif ( is_year() ) :
    $title = esc_html__( ‘Yearly Archives: ‘, ‘basel’) . get_the_date( _x( ‘Y’, ‘yearly archives date format’, ‘basel’ ) );
    else :
    $title = esc_html__( ‘Archives’, ‘basel’ );
    endif;
    }

    if ( is_author() ) {
    /*
    * Queue the first post, that way we know what author
    * we’re dealing with (if that is the case).
    *
    * We reset this later so we can run the loop
    * properly with a call to rewind_posts().
    */
    the_post();

    $title = esc_html__( ‘Posts by ‘, ‘basel’ ) . ‘<span class=”vcard”>‘ . get_the_author() . ‘</span>’;

    /*
    * Since we called the_post() above, we need to
    * rewind the loop back to the beginning that way
    * we can run the loop properly, in full.
    */
    rewind_posts();
    }

    if( is_search() ) {
    $title = esc_html__( ‘Search Results for: ‘, ‘basel’ ) . get_search_query();
    }

    ?>
    <div class=”page-title <?php echo esc_attr( $title_class ); ?> title-blog” style=”<?php echo esc_attr( $style ); ?>”>
    <div class=”container”>
    <header class=”entry-header”>
    <?php if( $page_title ): ?><h1 class=”entry-title”><?php echo $title; ?></h1><?php endif; ?>
    <?php if( $breadcrumbs ) basel_breadcrumbs(); ?>
    </header><!– .entry-header –>
    </div>
    </div>
    <?php
    return;
    endif;

    // Heading for portfolio
    if( is_post_type_archive( ‘portfolio’ ) || is_singular( ‘portfolio’ ) || is_tax( ‘project-cat’ ) ):

    $title = get_the_title( $page_for_projects );

    if( is_tax( ‘project-cat’ ) ) {
    $title = single_term_title( ”, false );
    }

    ?>
    <div class=”page-title <?php echo esc_attr( $title_class ); ?> title-blog” style=”<?php echo esc_attr( $style ); ?>”>
    <div class=”container”>
    <header class=”entry-header”>
    <?php if( $page_title ): ?><h1 class=”entry-title”><?php echo esc_html( $title ); ?></h1><?php endif; ?>
    <?php if( $breadcrumbs ) basel_breadcrumbs(); ?>
    </header><!– .entry-header –>
    </div>
    </div>
    <?php
    return;
    endif;

    // Page heading for shop page
    if( basel_woocommerce_installed() && ( is_front_page() || is_shop() || is_product_category() || is_product_tag() || is_singular( “product” ) || basel_is_product_attribute_archieve() )
    && ( $shop_categories || $shop_title )
    ):

    if( is_product_category() ) {

    $cat = $wp_query->get_queried_object();

    $cat_image = basel_get_category_page_title_image( $cat );

    if( $cat_image != ”) {
    $style = “background-image: url(” . $cat_image . “)”;
    }
    }

    if( ! $shop_title ) {
    $title_class .= ‘ without-title’;
    }

    ?>
    <?php if ( apply_filters( ‘woocommerce_show_page_title’, true ) && ! is_singular( “product” ) ) : ?>
    <div class=”page-title <?php echo esc_attr( $title_class ); ?> title-shop” style=”<?php echo esc_attr( $style ); ?>”>
    <div class=”container”>
    <div class=”nav-shop”>

    <?php if ( is_product_category() || is_product_tag() ): ?>
    <?php basel_back_btn(); ?>
    <?php endif ?>

    <?php if ( $shop_title ): ?>
    <h1><?php woocommerce_page_title(); ?></h1>
    <?php endif ?>

    <?php if( ! is_singular( “product” ) && $shop_categories ) basel_product_categories_nav(); ?>

    </div>
    </div>
    </div>
    <?php endif; ?>

    <?php

    return;
    endif;
    }

    #183128

    Hello,

    By default, when you on the shop page the title shows the Shop page. When you switch to a category page, the title would be changed: you will see the category page title and category menu below. As per your code, you are trying to change the Docan functionality. Our theme does not influence the Docan functionality and our support does cover such customization.

    Best Regards

    #183131

    Optilink
    Participant

    Hi Elise

    Thank you.

    Can you provide me with the code to fix the title whether in the shop page or in a category page please? And for this to be displayed in the product page as well?

    See attachment of how we want this to be displayed.

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #183293

    Hello,

    You need to change the code for this one:

    <h1 class="entry-title"><?php woocommerce_page_title(); ?></h1>
    <h1 class="entry-title"><?php echo get_the_title( get_option( 'woocommerce_shop_page_id' ) ); ?></h1>

    in this file: basel\inc\template-tags.php

    It is not possible to show Shop title on the Single product page.

    Best Regards

    #183314

    Optilink
    Participant

    Hi Elise,

    Thank you for providing this.

    I manage to display the title on the single product page as well. However, the categories menu doesn’t appear underneath the page title now. How can I display the categories menu please?

    #183329

    Hello,

    It is not possible to add Product Categories in the single product title.

    Best Regards

    #183333

    Optilink
    Participant

    What about the shop page? categories don’t appear on the shop page as well now.

    #183516

    Hello,

    Please provide the site admin access to the private area.

    Best Regards

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