Home › Forums › Basel support forum › i want to display category title where single product page › Reply To: i want to display category title where single product page
July 19, 2016 at 5:21 am
#2048
Artem Temos
Keymaster
Hello there,
Thank you for your question.
Try to add the following code to your child theme functions.php to display categories menu on the product page
add_action( 'wp', 'basel_page_title_single_init', 18 );
function basel_page_title_single_init() {
add_action( 'basel_after_header', 'basel_page_title_single', 11 );
}
function basel_page_title_single() {
global $wp_query, $post;
if( ! is_singular( 'product' ) ) return;
$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' );
$title_class .= $title_type;
$title_class .= ' title-size-' . $title_size;
$title_class .= ' color-scheme-' . $title_color;
$title_class .= ' title-design-' . $title_design;
?>
<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 basel_product_categories_nav(); ?>
</div>
</div>
</div>
<?php
}