Home › Forums › WoodMart support forum › Add categories to page title option also in frontpage
Add categories to page title option also in frontpage
- This topic has 3 replies, 2 voices, and was last updated 1 year, 2 months ago by Elise Noromit.
-
AuthorPosts
-
March 4, 2023 at 2:58 pm #448251
metuzaParticipantHello,
I am working on a new site using the grocery design and is wondering if it somehow is possible to show the categories as it is shown in shop page, also in ie. frontpage?
This is how it look like in shop page:
https://www.seilaks.no/butikk/Would be great to have the smae in frontpage.
Brgds
RuneMarch 5, 2023 at 3:52 am #448352
Elise NoromitMemberHello,
You can set the page title at the same time it is not possible to show the categories there. Such an option is provided in the shop /product categories.
You can create a block with the background and insert the product categories URL manually.
Alternatively, you can show the product categories by means of the builder widget: https://xtemos.com/docs-topic/elements-and-widgets/
If you have any questions please feel free to contact us.
Best Regards
March 5, 2023 at 4:48 pm #448413
metuzaParticipantHello,
Well, not to difficult. Using the below code now show page title with categories on all posts and pages:
// Setup page title with categories
function sel_woodmart_page_title() {if ( is_shop() || is_product_category() || is_cart() || is_checkout() || is_tax() ) return ”;
$disable = false;
$style = ”;
$title_class = ‘ page-title-‘;
$title_type = ‘default’;
$title_design = woodmart_get_opt( ‘page-title-design’ );
$title_size = woodmart_get_opt( ‘page-title-size’ );
$title_color = woodmart_get_opt( ‘page-title-color’ );
//$shop_title = woodmart_get_opt( ‘shop_title’ );
$page_title = get_the_title();
$shop_categories = woodmart_get_opt( ‘shop_categories’ );
$single_post_design = woodmart_get_opt( ‘single_post_design’ );
$title_tag = ‘h1’;
$custom_page_title_tag = woodmart_get_opt( ‘page_title_tag’ );
$page_id = woodmart_page_ID();if ( ‘default’ !== $custom_page_title_tag && $custom_page_title_tag ) {
$title_tag = $custom_page_title_tag;
}woodmart_enqueue_inline_style( ‘woo-shop-page-title’ );
if ( ! woodmart_get_opt( ‘shop_title’ ) ) {
woodmart_enqueue_inline_style( ‘woo-shop-opt-without-title’ );
}if ( woodmart_get_opt( ‘shop_categories’ ) ) {
woodmart_enqueue_inline_style( ‘shop-title-categories’ );
woodmart_enqueue_inline_style( ‘woo-categories-loop-nav-mobile-accordion’ );
}$title_class .= $title_type;
$title_class .= ‘ title-size-‘ . $title_size;
$title_class .= ‘ title-design-‘ . $title_design;if ( ‘large_image’ === $single_post_design && is_singular( ‘post’ ) ) {
$title_class .= ‘ color-scheme-light’;
} else {
$title_class .= ‘ color-scheme-‘ . $title_color;
}if ( 0 !== (int) $page_id ) {
$disable = get_post_meta( $page_id, ‘_woodmart_title_off’, true );
$image = get_post_meta( $page_id, ‘_woodmart_title_image’, true );
$custom_title_color = get_post_meta( $page_id, ‘_woodmart_title_color’, true );
$custom_title_bg_color = get_post_meta( $page_id, ‘_woodmart_title_bg_color’, true );if ( is_array( $image ) && isset( $image[‘id’] ) ) {
$image = wp_get_attachment_image_url( $image[‘id’], ‘full’ );
}if ( $image ) {
$style .= ‘background-image: url(‘ . $image . ‘);’;
}if ( ” !== $custom_title_bg_color ) {
$style .= ‘background-color: ‘ . $custom_title_bg_color . ‘;’;
}if ( ” !== $custom_title_color && ‘default’ !== $custom_title_color ) {
$title_color = $custom_title_color;
}
}if ( woodmart_get_opt( ‘shop_categories’ ) ) {
$title_class .= ‘ wd-nav-accordion-mb-on’;
}$title_class .= woodmart_get_old_classes( ‘ nav-shop’ );
?>
<?php if ( apply_filters( ‘woocommerce_show_page_title’, true ) && ! is_singular( ‘product’ ) ) : ?>
<div class=”custom-page-title”>
<div class=”page-title <?php echo esc_attr( $title_class ); ?> title-shop” style=”<?php echo esc_attr( $style ); ?>”>
<div class=”container”>
<?php if ( is_product_category() || is_product_tag() ) : ?>
<?php woodmart_back_btn(); ?>
<?php endif ?><?php if ( $page_title ) : ?>
<<?php echo esc_attr( $title_tag ); ?> class=”entry-title title”>
<?php echo $page_title; ?>
</<?php echo esc_attr( $title_tag ); ?>><?php do_action( ‘woodmart_page_title_after_title’ ); ?>
<?php endif; ?><?php if ( ! is_singular( ‘product’ ) && $shop_categories ) : ?>
<?php woodmart_product_categories_nav(); ?>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php
}
add_action( ‘woodmart_after_header’, ‘sel_woodmart_page_title’, 10 );Brgds
RuneMarch 7, 2023 at 5:08 am #448858
Elise NoromitMemberHello,
Thank you. Our developers will consider this issue.
If you have any questions please feel free to contact us.
Best Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register