filter single_cat_title avoiding the breadcrumbs

I'm developing a simple plug in and I need to filter single_cat_title in category page adding some html in every category page. Just doing this: function subtitleCategory ($title) { return $title."</div></div></div><div class=\"container_24\"><h2 id=\"category-subtitle\">TEST1</h2></div>"; } add_filter('single_cat_title', 'subtitleCategory'); I get what I need. But I noticed that this filter also apply to the breadcrumbs (there is a call in breadcrumbs.php) and this means twice in the same page (not what I need). Do you know if there is a condition that can …
Category: Web

Multiple categories assigned to a single product breaking the breadcrumb

custom bread crumb not working with multiple categories assigned to a single product, we do not have the categories page, so don't want to show categories in the URL, but need to show the categories navigation on the breadcrumb . <?php function bootstrap_breadcrumb($custom_home_icon = false, $custom_post_types = false) { wp_reset_query(); global $post; $is_custom_post = $custom_post_types ? is_singular($custom_post_types) : false; $post_type = get_post_type(get_the_ID()); if (!is_front_page() && !is_home()) { echo '<ol class="d-flex breadcrumb-wrapper">'; echo '<li><a href="'; echo get_option('home'); echo '">'; if ($custom_home_icon) …
Category: Web

how to add custom breadcrumbs in wordpress?

I need a custom breadcrumb for my account page.Can we do it via functions.php ? add_filter('theme_breadcrumb_args_filter', 'customize_separator_breadcrumbs'); function customize_separator_breadcrumbs($args) { $args['sep'] = ' >> '; return $args; }
Category: Web

Breadcrumbs and Categories

I have a post with two/three categories associated to it. Category 1 (1) and Category 2 (2). Number two also has a sub category (2.1) I select the sub category (2.1) to be the primary category. However, in the bread crumbs the category 1 always shows. I don't understand how I can make the category sting 2 to show in the bread crumbs instead. I use the Yoast plugin to make the (2.1 category to be my primary category). Should't …
Category: Web

Link custom post type to parent page and show in slug / breadcrumb

I am using the Custom Post Type UI plugin to add custom post types to our website. We now created a CPT called IPDC. For this custom post type, we would like to have the option to link every IPDC page to a parent page, the parent page being a default Wordpress page. I guess I could do this by adding a custom field, but how do I manage the slug and breadcrumb in that case? For example. The IPDC …
Category: Web

How to add woocommerce products header title in woocommerce_breadcrumb hook to function.php

Iam new to WooCommerce theming and get stuck with category display page here is the code i have: /** * Change several of the breadcrumb defaults */ add_filter('woocommerce_breadcrumb_defaults', 'jk_woocommerce_breadcrumbs'); function jk_woocommerce_breadcrumbs() { if (is_product_category()) { global $wp_query; // get the query object $cat = $wp_query->get_queried_object(); // get the thumbnail id using the queried category term_id $thumbnail_id = get_term_meta($cat->term_id, 'banner', true); // get the image URL $image = wp_get_attachment_url($thumbnail_id); // print the IMG HTML echo ""; return array( 'delimiter' => ' …
Category: Web

How to obtain page breadcrumb based on menu structure only?

I want to obtain a path of all parents for current page. Something similar to breadcrub but used only for pages listed in menu. For example if i have following structure: L Menu L Sub menu L Current page L Sub menu 2 L Menu 2 I want to obtain: Menu >> Sub Menu >> Current page I am using WordPress 5.0.2. I tried various plugins but they show only current page instead of whole path. How do i solve …
Category: Web

Getting error when trying to implement site-wide breadcrumbs in Twentytwentyone Theme

I've purchased the Yoast SEO Premium plugin earlier this year, but I wasn't able to figure out how to enable breadcrumbs until a few days ago. At first I thought I had to add blocks to every page and post, and I thought that would be incredibly tedious, until I found this article. Since I was already using the Twentytwentyone theme, I decided to add the code to its header.php file. <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb( '<p id="breadcrumbs">','</p>' …
Category: Web

How to add Schema markup to breadcrumbs

I've used the code from this answer in the breadcrumbs, and it works well. I also added Schema.org markup: https://schema.org/BreadcrumbList Please see at the bottom under "Microdata", It asks to add this line: <meta itemprop="position" content="1" /> under each menu item. I can add it to the home page like this: <ul> <li><a href="<?php echo home_url(); ?>/projects">Projects</a><meta itemprop="position" content="1" /></li> <?php $term = get_term_by("slug", get_query_var("term"), get_query_var("taxonomy") ); $tmpTerm = $term; $tmpCrumbs = array(); while ($tmpTerm->parent > 0){ $tmpTerm = get_term($tmpTerm->parent, …
Category: Web

Error in Fetching Custom Post Type parent Category URL (slug)

I have this code for breadcrumbs that works fine except the custom post type parent category URL and the category TITLE. The parent category URL is does not return the valid (correct) slug while its title (anchor) returns a text with description on it like CATEGORY - BOOKS. Although I am a bit of a mediocre in coding but I am open for learning. I figured out the code responsible for displaying the invalid parent category is below elseif ( …
Category: Web

Title and URL Error in Breadcrumb Navigation for Custom Post Types

I have this code I got from here on StackOverflow. It works great across my wordpress site but the problem is that on the custom post type single pages, the parent category's link it fetches for every custom post type links to the current post itself and not the parent category link. Again, the title it fetches for same category has some descriptions attached to the anchor (title). For example: Home > Category: Books > Things Fall Apart In this …
Category: Web

Hierarchy pages from yoast breadcumbs

I want to use yoast seo breadcrumbs in my web site, but when I set it up, the hierarchy doesn't look right, I have a mega menu and the parent pages doesn't appear in the breadcrumbs For example in this case the breadcumbs should be: Inicio > Productos > Análisis de gases > Analizador o3 instead of Inicio > o3 how can I solve it?
Category: Web

how can i modify astra breadcrumb shortcode's home?

i use astra theme's breadcrumb shortcode into elementor and create pages, but the breadcrumd's begin always shows as "Home" instead of my language. i make a search and find this articles, https://developers.wpastra.com/astra-pro/reference/functions/astra_breadcrumb/ about the line 'home' => __( 'Home', 'astra-addon' ), if i change the Home to my language words,the breadcrumb's "Home" will be translated well. i want to ask if i can add a codes into functions.php and let it replace as my language words well ? thanks
Category: Web

Post template with breadcrumb needs to show page navigated from

I have a custom post type, Reports, that contains many categories (custom taxonomies). These posts are organised in menus on different pages. So a menu page named "Best Reports" would have multiple sections, ie: *Best Reports* From Today (List of posts tagged with the categories of "best" and "today") From Yesterday (List of posts tagged with the categories of "best" and "yesterday") Another menu page would look like *Worst Reports* From Today (List of posts tagged with the categories of …
Category: Web

is_shop, is_home, is_front_page doesn't work for woocommerce

I tried to remove breadcrumbs from homepage because it looks really ugly, but i can't do this because conditionals don't work. *I took that from woocommerce docs add_action( 'init', 'wcc_remove_woo_wc_breadcrumbs' ); function wcc_remove_woo_wc_breadcrumbs() { if ( is_home() || is_shop() || is_front_page() ) { remove_action( 'woo_main_before', 'woo_display_breadcrumbs', 10 ); } } Line remove_action( 'woo_main_before', 'woo_display_breadcrumbs', 10 ); works correct, but unfortunatelly conditional tags don't. Do you have any ida on woocommerce shop page as homepage?
Category: Web

Woocommerce Porto Theme Hide Selected Categroy for Breadcrumbs

I try everything. My breadcrumbs is not default to Woocommerce. I use Porto Theme for Wordpress. This is my breadrumbs.php <?php global $porto_settings; $breadcrumbs = $porto_settings['show-breadcrumbs'] ? porto_get_meta_value( 'breadcrumbs', true ) : false; $page_title = $porto_settings['show-pagetitle'] ? porto_get_meta_value( 'page_title', true ) : false; if ( ( is_front_page() && is_home() ) || is_front_page() ) { $breadcrumbs = false; $page_title = false; } $title = isset( $porto_shortcode_title ) ? $porto_shortcode_title : porto_page_title(); $sub_title = isset( $porto_shortcode_sub_title ) ? $porto_shortcode_sub_title : porto_page_sub_title(); $hide_title …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.