WordPress.org

Ready to get started?Download WordPress

Forums

Breadcrumb NavXT
Some pages show wrong breadcumb trail (22 posts)

  1. Niklas
    Member
    Posted 2 years ago #

    Need help to find out why some pages on our multisite installation (3.3.2) keeps generating incorrect breadcrumb trails. How can I best contact you?

    http://wordpress.org/extend/plugins/breadcrumb-navxt/

  2. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    Usually just posting what's up is fine. I like to keep support either on my website or on these forums. Other than that, my contact information is on my website and in the Breadcrumb NavXT code. Please make sure you detail what is going on (what you are getting, what you are expecting). In this case, also let know what they items in the breadcrumb trail are (e.g. posts, categories, pages, tags, custom taxonomy terms, custom post types, etc.).

  3. Niklas
    Member
    Posted 2 years ago #

    Well, the problem is quite hard to nail down onto a probable cause. But here goes…

    WordPress 3.2.2, multisite with subdomains, running NavXt 4.1.0

    It only affects the Post post type as far as I can tell (the built in, but we have renamed it to News), anyway, on these posts the breadcrumb has this structure

    Home link > Parent Page > News Post Title

    One News post seems to over-write some other News posts as far as NavXt is concerned so that the post "Look here" has the breadcrumb

    Home > News archive > Look Here

    But the News post "What happened today" also gets the "Look here" bread crumb:

    Home > News archive > Look Here

    When it should be

    Home > News archive > What Happened Today

    Same thing with other News posts.

  4. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    Do you have any secondary loops (recent posts widget)? If so they could be doing things incorrectly and causing the problem.

  5. Niklas
    Member
    Posted 2 years ago #

    I don't think so. I tried to remove all other widgets on the page but it did not help.

  6. Niklas
    Member
    Posted 2 years ago #

    I found another clue to the bug. Each time a new post is published the "dominant" (bread crumb that takes over the other bread crumb) changes to some other post.

    Edit: I just found occasions where this issue is not confined to a specific post type, the "dominant" bread crumb even takes over the Page bread crumb on some pages.

  7. Niklas
    Member
    Posted 2 years ago #

    Can I send you anything like settings info, screen shots or database table rows?

  8. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    This "dominate" breadcrumb behavior is definitely due to something incorrectly modifying the $post variable. One other thing you should try is using one of the themes WordPress ships with (and have Breadcrumb NavXT as the only active plugin), twentyeleven or twentyten should do. See if the behavior continues with one of those two themes.

  9. Niklas
    Member
    Posted 2 years ago #

    This is the modification, it has worked fine and I can't see any bugs.

    add_action('init', 'nbr_rename_posts');
    function nbr_rename_posts() {
    	global $wp_post_types, $menu, $wp_rewrite;
    	register_post_type('post', array(
    		'label' => __('News', 'nbrpost'),
    		'labels' => array(
    			'name' => __('News', 'nbrpost'),
    			'singular_name' => _x('News', 'post type singular name', 'nbrpost'),
    			'add_new' => __('Add News', 'nbrpost'),
    			'add_new_item' => __('Create news post', 'nbrpost'),
    			'edit_item' => __('Edit news', 'nbrpost'),
    			'new_item' => __('New News', 'nbrpost'),
    			'view_item' => __('Display News', 'nbrpost'),
    			'search_items' => __('Search News', 'nbrpost'),
    			'not_found' =>  __('No News Found', 'nbrpost'),
    			'not_found_in_trash' => __('No News Found In Trash', 'nbrpost'),
    			'parent_item_colon' => '',
    			'menu_name' => __('News', 'nbrpost')
    		),
    		'public' => true,
    		'show_in_menu' => false,
    		'rewrite' => array(
    		    'slug' => 'nyheter',
    		    'with_front' => true
    		),
    	));
    }

    Edit: Tried Twenty-eleven 1.3 and Breadcrumbs doesn't even show up in that theme. All other widgets are visible though.

  10. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    On the twenty-eleven theme you'll need to add in the breadcrumb calling code, or use the Breadcrumb NavXT widget (ships with Breadcrumb NavXT).

    As for the posted code, that may not be the best way of renaming the posts post type to something more usefully, but nothing jumps out at me as being horribly wrong. I'll have to try it on my testbed and see it I get the odd behavior with it.

  11. Niklas
    Member
    Posted 2 years ago #

    I tried placing the widget in all different spots (using content to the left) but the breadcrumbs were absent.

  12. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    Where did you have that nbr_rename_posts code located? On my testbed it doesn't end up changing posts to 'News', and does cause some funky PHP errors. BTW, have you tried running with WP_DEBUG set to true?

  13. Niklas
    Member
    Posted 2 years ago #

    It does not rename the menu items (but renames them everywhere else). To rename the menu items you need to run this code (together with the earlier) in a module:

    add_action('admin_head', 'nbr_modify_menus');
    function nbr_modify_menus() {
        global $menu;
        global $submenu;
    
        if ($menu[5][2] == 'edit.php') {
    	    $menu[5][0] =  __('News', 'nbrpost');
    	    $submenu['edit.php'][5][0] = __('All news', 'nbrpost');
    	    $submenu['edit.php'][10][0] = __('Create news', 'nbrpost');
        }
    }

    We have to run the production environment with WP_DEBUG set to false, but I have tested the install on a local server and the above code sends no errors.

  14. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    Locally you are having the same problem? Can you try commenting out both sections of the code that renames posts to news?

  15. Niklas
    Member
    Posted 2 years ago #

    That does not help. :(

    I discovered something else, I can never get it to happen on the main site (site.com) but it only happens on subsites (subsite.site.com).

  16. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    I'm trying to reproduce this on my multisite install (3.4, I always test against WP trunk), but I'm not seeing the issue. I uncovered another minor issue regarding the link to the mainsite if that breadcrumb is shown, but that's now fixed.

    For the Twenty Eleven theme, place the Breadcrumb NavXT widget in the "Footer 1" location. It should show up on all pages for the subsite. Try again to see if doing that and disabling all custom code (other than having Breadcrumb NavXT enabled) causes the issue to still exist.

    Are you using anything custom in your .htaccess file? I can't actually visit single post pages when using your post renaming code.

  17. Niklas
    Member
    Posted 2 years ago #

    We migrated from Apache to Nginx at the same time wordpress.org did, we therefore use no .htaccess file at all.

  18. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    There still is a config file that specifies your rewrites. Are you using anything custom from what is in http://codex.wordpress.org/Nginx ?

  19. Niklas
    Member
    Posted 2 years ago #

    Nothing deviates, it hasn't been touched.

  20. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    Reading from the top of the topic again, have you identified all areas where the $post variable is being set? You should do a search (awk, grep) for all instances of $post in your wp-content directory.

    You may also want to try wp_reset_postdata() or wp_reset_query() before your call to bcn_display().

  21. Niklas
    Member
    Posted 2 years ago #

    I was on to something similar just now, if I disable everything except the WP tag cloud widget and then modify the core widget's widget() function to reset there. I noticed that the "dominant" bread crumb was always tagged with the first tag in the tag cloud.

    echo $after_widget;
    wp_reset_postdata();

    …seems to solve it, but I am not comfortable modifying WP core because it will break in updates.

  22. John Havlik
    Member
    Plugin Author

    Posted 2 years ago #

    If WP Tag Cloud widget is one that ships with WordPress, you should consider opening a ticket in core.trac.wordpress.org about it abusing the $post variable.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.