KoZm0kNoT
Forum Replies Created
-
Forum: Plugins
In reply to: [Breadcrumb NavXT] error in 5.1.0 updateGot it figured out. I have a shortcode function that creates a list of CPT posts. This code executes prior to the template page that actually displays the content. The content is “queued up” using the PHP “ob_start” and finishes with “ob_end_clean”, then this content is passed on to the page. This function gets its list of CPT posts using a WP_Query, so the $POST gets used during this process.
In the page that displays the list CPT posts, I had the breadcrumb statement “bcn_display()” BEFORE I executed the “the_post()” function, so breadcrumb was trying to use the LAST CPT post from the shortcode function instead of the WP_Post object of my page. Once I moved my breadcrumb command AFTER “the_post”, then it had the correct WP_POST object and fixed the issue. Here is how it looked before and after:
BEFORE:
<?php get_header(); ?> <div class="breadcrumb-wrap"><?php bcn_display();?></div> <?php if ( have_posts() ) { while ( have_posts() ) { the_post();
AFTER:
<?php get_header(); if ( have_posts() ) { while ( have_posts() ) { the_post(); ?> <div class="breadcrumb-wrap"><?php bcn_display();?></div>
So if you are running queries prior to displaying the results, make sure you have your page WP_Post before calling breadcrumb.
Forum: Plugins
In reply to: [Breadcrumb NavXT] error in 5.1.0 updateOk I have some additional details now. The page I’m having issues on simply displays a list of CPT posts. I use Microsoft WebMatrix on Windows 8.1 for my development work, then Filezilla the changes to a production hosted Apache server. The two environments are behaving differently. The WebMatrix side works as expected – the breadcrumb displays the name of the PAGE, as I want it. However, on the Apache server, it uses the last CPT POST on the page in the breadcrumb…not the page itself. For some reason, there seems to be some sort of delay…breadcrumb is not grabbing the page name at the top but waits until the whole page is displayed before getting the current $POST value to put in the breadcrumb.
This is related to the WP_POST object error because for some reason before I upgraded breadcrumb, it did not exhibit this behavior. Also, something has changed in WP in the way new posts are created since old CPT posts do not break breadcrumbs.
Forum: Plugins
In reply to: [Breadcrumb NavXT] error in 5.1.0 updateI am having this issue on my site with custom post types. BUT, I have some caveats….it’s ONLY on new posts I create and only on one certain page where I list all my posts. Breadcrumbs work perfectly when I display the individual post, even on the new ones. I have a sneaky suspicion there is a bug on this one particular page and the WP_Post object is not getting cast properly (hence the error about it not being a WP_Post object, which it clearly is.) I didn’t write the code on the page with the problem – it was part of a package I purchased – so I’ll need to debug it. As soon as I figure out what’s going on I’ll post the results and hopefully it may help others. Since it worked in earlier versions, there might have been some sloppy code floating around that a lot of people found on google and used that now won’t work in the newer, cleaner versions of Breadcrumb. But that still doesn’t explain why only new posts don’t work on this one page.