If post type = forum then breadcrumbs Home > Forums

I managed to fix this by: <?php function the_breadcrumb() { global $post; $post_type = $post->post_type; echo ‘<ul id=”breadcrumbs”>’; if(get_post_type() == ‘forum’ OR get_post_type() == ‘topic’ OR get_post_type() == ‘reply’) { echo ‘<li><a href=”‘; echo get_option(‘home’); echo ‘”>’; echo ‘<i class=”ts-awesome-home” style=”font-size:14px;letter-spacing: 2px;”></i> Home’; echo ‘</a></li><li class=”separator”> / </li>’; echo ‘<a href=”https://link”>Forum</a>’; echo ‘ &nbsp;/&nbsp; ‘; … Read more

Modify php code to pass a page id as a parameter in order to create a breadcrumb

I simply had to remove ‘is_page() && ‘ in both the if and the elseif function the_ajax_breadcrumb($post_id) { ob_start(); $args = array(‘page_id’ => $post_id); $the_query = new WP_Query($args); $currentBefore=”<li><a>”; $currentAfter=”</a></li>”; while ( $the_query->have_posts() ) { $the_query->the_post(); if ( !is_home() && !is_front_page() || is_paged() ) { echo ‘<nav class=”breadcrumb”><ul>’; if ( !$the_query->post->post_parent ) { echo $currentBefore; … Read more

Show only one level in breadcrumbs

You can use wp_get_post_parent_id to return just the parent ID of the page in question. Then you can use get_the_title and get_permalink with that parent ID to build a back button to the parent page; <?php if( $parent = wp_get_post_parent_id( get_the_ID() ) ): ?> <a href=”https://wordpress.stackexchange.com/questions/167269/<?php echo get_permalink($parent); ?>”><?php echo get_the_title($parent); ?></a> <?php endif; ?> … Read more

How to add a breadcrumb to WordPress header?

I always like the non-plugin solution, even if it’s a hard one. To create a breadcrumb, you will need to functions. One, will create a chain of items ( such as categories ) for you. This will be used to form the breadcrumb later: function get_category_parents( $id, $link = false, $separator=”https://wordpress.stackexchange.com/”, $nicename = false, $visited … Read more

Customising Breadcrumb NavXT [closed]

For option a, see the Breadcrumb NavXT FAQ. For option b, since there isn’t an all encompassing “current item breadcrumb template”, you have two options: Since all the unlinked breadcrumb templates are used for the current item, just replace the %title% and %htitle% tags with ‘You are here’. Write a filter for the bcn_breadcrumb_title hook, … Read more

Get the terms of a post

Solved I’ve solved it by myself. The WordPress function get_the_term_list() returns the terms of the post, but unfortunately they are in the reversed hierarchical order, so I had to turn them around. $id = get_the_ID(); $terms = get_the_term_list( $id , $taxonomy , ” , $randomstring ); $terms_array = explode( $randomstring , $terms ); $terms_string = … Read more