Title: [Plugin: Breadcrumb NavXT] Breadcrumb inside a query post
Last modified: August 20, 2016

---

# [Plugin: Breadcrumb NavXT] Breadcrumb inside a query post

 *  [gumail](https://wordpress.org/support/users/gumail/)
 * (@gumail)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-breadcrumb-navxt-breadcrumb-inside-a-query-post/)
 * Is there an easy way to use Breadcrumb inside a query post?
    I want to display
   the whole path for each found post, when user made a search.
 * I tried to set setup_postdata(get_post($post->ID)), but didn´t work
 * Thank you!
 * [http://wordpress.org/extend/plugins/breadcrumb-navxt/](http://wordpress.org/extend/plugins/breadcrumb-navxt/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [John Havlik](https://wordpress.org/support/users/mtekk/)
 * (@mtekk)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-breadcrumb-navxt-breadcrumb-inside-a-query-post/#post-2955084)
 * Well there are two things to consider. The `bcn_breadcrumb_trail::fill()` function
   checks to see if `bcn_breadcrumb_trail::trail` contains any members, if so it
   exits early (e.g. things were cached). So if you use the wrapped `bcn_display()`
   or `bcn_display_list()` you will always get the same breadcrumb trail (and the
   heavy lifting parts of the plugin only run once). The other is you will need 
   to ensure that the WordPress conditionals are set properly for things to work.
 * Now, there is a way to get around the caching issue. You will need to directly
   instantiate the `bcn_breadcrumb_trail` class, but that isn’t too difficult. If
   you want to use the same settings as `bcn_display()` or `bcn_display_list()` 
   use the following:
 *     ```
       $breadcrumb_trail = new bcn_breadcrumb_trail();
       $breadcrumb_trail->opt = get_option('bcn_options');
       $breadcrumb_trail->fill();
       $breadcrumb_trail->display();
       ```
   
 * Just place that where you would place `bcn_display()` in your query loop.
 *  Thread Starter [gumail](https://wordpress.org/support/users/gumail/)
 * (@gumail)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-breadcrumb-navxt-breadcrumb-inside-a-query-post/#post-2955088)
 * 🙁
    Well, I´m using it inside the search template, but still getting only the
   search path, not the post path
 * I tried to something like
    $breadcrumb_trail->fill(get_post($post->ID));
 * And change the function to
    function fill($newID = null) { global $wpdb, $post,
   $wp_query, $paged, $page; //Check to see if the trail is already populated
 *  if(is_search())
    setup_postdata($newID);
 *  .
    . . if(!$newID) do_action(‘bcn_after_fill’, $this); } Thanks again mtekk!
 *  Plugin Author [John Havlik](https://wordpress.org/support/users/mtekk/)
 * (@mtekk)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-breadcrumb-navxt-breadcrumb-inside-a-query-post/#post-2955178)
 * After looking at it again there is more to this than I initially thought. It 
   looks like the order of checking conditionals within the fill function makes 
   it quite robust for determining the breadcrumb trail, except when you want it
   to update for the current post within a loop (it keeps finding the main containing
   page).
 *  Thread Starter [gumail](https://wordpress.org/support/users/gumail/)
 * (@gumail)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-breadcrumb-navxt-breadcrumb-inside-a-query-post/#post-2955194)
 * Do you have any tip to work inside the search query?
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: Breadcrumb NavXT] Breadcrumb inside a query post’ is closed 
to new replies.

 * ![](https://ps.w.org/breadcrumb-navxt/assets/icon.svg?rev=1927103)
 * [Breadcrumb NavXT](https://wordpress.org/plugins/breadcrumb-navxt/)
 * [Support Threads](https://wordpress.org/support/plugin/breadcrumb-navxt/)
 * [Active Topics](https://wordpress.org/support/plugin/breadcrumb-navxt/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/breadcrumb-navxt/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/breadcrumb-navxt/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [gumail](https://wordpress.org/support/users/gumail/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-breadcrumb-navxt-breadcrumb-inside-a-query-post/#post-2955194)
 * Status: not resolved