Home › Forums › WoodMart support forum › Page title with categories on all pages
Page title with categories on all pages
- This topic has 2 replies, 2 voices, and was last updated 13 minutes ago by metuza.
-
AuthorPosts
-
November 18, 2024 at 7:28 pm #613110
metuzaParticipantHello,
For a few years i have been using the page title option including product categories on all pages, blogs, products etc. You can see how it works with previous version of Woodmart: https://www.arctic-fritid.as and you will see categories below page title on absolutely all pages.
But today with version 8.0 i lost it and can not find back the function in which i had edited to make it work. This is the function that i have edited in my child functions so i could have full page title as you have seen in my mentioned site.
// Setup page title with categories
function afas_woodmart_page_title() {if ( is_front_page() || 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();
if ( is_home() ) {
$page_title = get_the_title( get_option(‘page_for_posts’, true) );
}
if ( is_category() ) {
$category = get_the_category();
if ( ! empty( $category ) ) {
$page_title = $category[0]->name;
}
}
if ( is_tag() ) {
$term = get_queried_object();
$page_title = ‘OPPSKRIFTER MED ‘ . $term->name;
if ( $term->name == “Annet” ) {
$page_title = $term->name . ‘ UTSTYR OG TILBEHØR’;
}
}
$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’ ) ) : ?>
<?php if ( apply_filters( ‘woocommerce_show_page_title’, true ) ) : ?>
<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 if ( $shop_categories ) : ?>
<?php woodmart_product_categories_nav(); ?>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php
}
add_action( ‘woodmart_after_header’, ‘afas_woodmart_page_title’, 10 );So my question is, where can i again find the function that controls page title with categories?
Brgds
RuneNovember 19, 2024 at 6:22 pm #613530
Luke NielsenKeymasterHello,
Navigate to
/inc/template-tags/template-tags.php
file and in the 1119 line you can find that code – https://prnt.sc/QYb7lfKhFEaKDon’t hesitate to ask if something isn’t clear.
Kind Regards
November 19, 2024 at 8:32 pm #613572
metuzaParticipantHello,
Thank you 🙂 I also did figure out why all page titles was just blank, no background images was loaded. The class “wd-page-title” was missing in all pages, archives and around so when i added it to your code everything was ok.
Brgds
Rune -
AuthorPosts
- You must be logged in to create new topics. Login / Register