Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Havlik

    (@mtekk)

    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

    (@gumail)

    🙁
    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

    (@mtekk)

    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

    (@gumail)

    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.