Viewing 15 replies - 1 through 15 (of 16 total)
  • Frankly, I have got the same problem. Plugin works like charm except for posts/articles and pages. Weird is that it displays breadrcrumbs to custom pages made by another plugins like The Events Calendar for example.

    Current pages and posts breadcrumbs are not shown though. Is there any way to fix it?

    I use gantry 5 and Hydrogene theme.

    Plugin Author John Havlik

    (@mtekk)

    How are you calling the breadcrumb trail? If you look at the HTML of the page in question (the one without the trail showing up), is there any indication that the breadcrumb trail should be there? That is, if you wrapped the call to bcn_display() in a div, is the div there?

    Yes, there is that trail there, but it only show one element (Homepage). Meta content in the div structure indicates “1” element to display, too.

    It doesnt show current page though and current article or current post. Post categories are also visible on the trail, but posts are not.

    It is really weird. I tried another breadcrumbs plugins, and weird is that they couldn’t handle other stuff (like The Events Calendar) but they worked well when it comes to posts and pages.

    Plugin Author John Havlik

    (@mtekk)

    The <meta property="position"> tag indicates the breadcrumb’s position in the trail, it is part of Schema.org’s BreadcrumbList specification.

    As for your actual issue, does the theme have an actual/traditional loop, or are they doing something else? Breadcrumb NavXT depends on the WordPress Conditionals to be correct at the time that bcn_display() is called. And, from what I can tell from the live demo of Hydrogene, some goofy things may be happening loop wise. Do you have any other plugins activated (just trying to rule out any goofy interactions)?

    I turned off all plugins but with no effect. I only was forced to keep Timber and Gantry 5 because they are crucial plugins to make Hydrogen theme works.

    I have no idea what is wrong… If you would be willing to check files on my site that would be great.

    Hi,

    Gantry 5 developer here. We are using Timber library plugin as a WP library to provide Twig support for the G5 powered themes. The query and conditional tags should be fine. If you need to call a bcn_display() function in a Twig file you can try any of these :

    {{ function('bcn_display') }}

    or

    {{ wordpress.call('bcn_display') }}

    They should be the same.

    @gantry

    Thanks for answer! Both of these code snippets works, but the problem with the plugin still exists ;/

    It only shows first element of the breadcrumb trail when it comes to pages (Homepage -> NOTHING) and posts (Homepage -> Category -> NOTHING). Buddy Press sites, The Event Calendar sites (and posts!) works fine.

    I just played with the plugin and looks like it throws a notice when the $post object isn’t coming from the WP_Posts class, which causes the issue as we use Timber library and it’s classes.

    Can you please try to edit the /wp-content/plugins/breadcrumb-navxt/class.bcn_breadcrumb_trail.php file and on line 389 change this code :

    if(!is_object($post) || get_class($post) !== 'WP_Post')

    to this :

    if(!is_object($post) || (get_class($post) !== 'WP_Post' && get_class($post) !== 'Timber\Post'))

    Did this worked ?

    Thread Starter Sherry22

    (@sherry22)

    yes it did – thanks very much

    Great! πŸ™‚ @john can you please consider adding the modified code to your plugin ?

    Thanks!

    Plugin Author John Havlik

    (@mtekk)

    Modifying the $post global to not be a WP_Post or WP_Error object is not a good idea. Even worse is reimplementing WP_Post rather than extending it. The check is there because this behavior is unexpected.

    However, the next version of Breadcrumb NavXT is moving away from trusting the $post global’s object (this has been slowly happening for a while now). Instead, it will use a different method and fetch the WP_Post object itself. This should work around this issue.

    I’m aware of that John, it was just a workaround to make it work with Timber library which we use as a Twig implementation for WordPress.

    @gantry

    Thank you very much! It works perfect now! πŸ˜‰

    Plugin Author John Havlik

    (@mtekk)

    @jakku17 and @sherry22, can you try the infielder branch of Breadcrumb NavXT to see if it resolves this problem? See https://github.com/mtekk/Breadcrumb-NavXT/tree/infielder
    I changed a couple of things that may work around this (no longer directly look at the $post global).

    @john

    It works as well ;-). I just have tested it. Thanks!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘show current post or page’ is closed to new replies.