CM Tooltip (CMTG) - Extras - Configuring Breadcrumbs

Configuring Breadcrumbs

Disclaimer: This section doesn't cover all of cases, so the knowledge presented here may not apply to your theme.


Many themes have a breadcrumbs functionality which assist the main navigation of the site. Unfortunately it's not one of the core WordPress functions,
so it means that in each theme it can work differently, which is the main reason why many of our customers are asking about the help to configure the way breadcrumbs work with CM Tooltip Glossary.

Breadcrumbs usually look similar to this:

Home -> Category -> Post Name

Below: Example of breadcrumbs from Enfold theme

Sometimes a site needs input from the community it serves.

With the Glossary Community Terms add-on users can help to build your glossary as you watch your key content grow.

Use Cases

Usually breadcrumbs are not very customizable (if at all), while many users expect to be able to change their behavior. Also in some themes the breadcrumbs do not support custom post types at all.

In case of our plugin the most often use cases are:

  • Need to remove the breadcrumbs at all on the Glossary Term Pages
  • Need to add the Glossary Index Page in the trail
  • Need to add the tag/category in the breadcrumb trail on the Glossary Term pages
  • Breadcrumbs not showing at all

In most cases some form of code manipulation on the theme is required to achieve the expected result.

How To Find Breadcrumbs In Theme

The easiest way to find the breadcrumbs function is to ask the theme owner for the file and the function name.

Usually the functions responsible for the breadcrumbs will have the word 'breadcrumbs' in it, so if you're familiar with the text editors, you can try to search for it in the theme files.

Code Examples

This section contains the code required to make changes in the breadcrumbs functionality in specific themes.

Of course there are hundreds of thousands of themes out there and each one can theoretically add it's own implementation of breadcrumbs, so it's impossible to support them all.

Enfold (Avia Breadcrumbs)

The breadcrumbs in the Enfold theme base on modified WooThemes breadcrumb code. This is a popupar theme, and a popupar implementation, so it's possible that you will have the same/similar code
if you've bought one of the most popular themes (Avada/Divi) etc.

The function is called avia_breadcrumbs() and it can be found in the class-breadcrumb.php file

Thankfully this version is using a filter so we can quite easily hook into it and add new things to the breadcrumb list.

	/* Allow child themes/plugins to filter the trail array. */
	$trail = apply_filters( 'avia_breadcrumbs_trail', $trail, $args );<br>

Here's an example code which you can use if you'd like to add the Glossary Index Page to the listing (for users visiting Glossary Term Page):

add_filter('avia_breadcrumbs_trail', 'cminds_add_glossary_index_to_breadcrumbs', 10, 2);

function cminds_add_glossary_index_to_breadcrumbs($trail, $args) {
	$post		 = $wp_query->get_queried_object();
	$post_type	 = $post->post_type;
	if ( 'glossary' === $post_type && class_exists( 'CMTT_Glossary_Index' ) ) {
		$last_element = array_pop( $trail );
		$glossaryPageId		 = CMTT_Glossary_Index::getGlossaryIndexPageId();
		$glossaryPageLink	 = get_permalink( $glossaryPageId );
		$trail[]			 = '<a href="' . $glossaryPageLink . '">' . get_the_title( $glossaryPageId ) . '</a>';
		array_push( $trail, $last_element );
	return $trail;

If you put this code into your theme's function.php file it will work if you have the CM Tooltip Glossary plugin active.

More information about the  CM Tooltip Glossary WordPress  Plugin

Other WordPress products can be found at  CreativeMinds WordPress Store

Let us know how we can  Improve this Product Documentation Page 

To open a  Support Ticket visit our support center