John Havlik
Forum Replies Created
-
Forum: Plugins
In reply to: [Breadcrumb NavXT] The plugin change my permalinkI guess I don’t fully understand your question. Breadcrumb NavXT is not influenced by the URL structure, and the breadcrumb trail does not necessarily match the URL structure of a site. Breadcrumb NavXT relies on the actual content organization within WordPress, which may not match the permalink structure. That said, if you are using just pages (instances of the page post type), the default way WordPress generates permalinks is to have the full hierarchy in the URL. Normally, that isn’t a problem (honestly, I’m not sure how/why you think your URLs are too long, very few people type in URLs past the main page on a site these days so it really does not matter).
Forum: Plugins
In reply to: [Breadcrumb NavXT] Displaying full trailThere are a couple of things you may need to change.
The first, in the Breadcrumb NavXT settings, for the “Home Template” you may need to replace
%title%and%htitle%with “Home” (it appears it is trying to add the breadcrumb but the title is blank).The second, for the category hierarchy, for your page, make sure only “Sub-sub category” is checked in the editor for that post. Since categories are hierarchical taxonomies, a post being a member of a child category will automatically make it an implicit member of the child category’s parent category (and the parent category’s parent, etc.). Hence, making a post be an explicit member of multiple categories within a hierarchy doesn’t really make sense as it is redundant. The behavior you are seeing is due to Breadcrumb NavXT using the first category it found with a parent category (since more than one category was returned by
get_the_terms).That looks like WordFence is being way too aggressive (unless you actually are trying to set something ‘bad’ in the settings but that doesn’t sound like it’s the case). For whatever reason, WordFence doesn’t seem to like the breadcrumb templates, which are settings that allow some HTML. That said, before the breadcrumb template settings are actually saved, they are run through
wp_kses()with a very limited list of allowed tags and attributes. JavaScript of any type (required for XSS) will be stripped out at that stage.Forum: Plugins
In reply to: [Breadcrumb NavXT] Breadcrumb NavXT hierarchyIf you are trying to add the state and city into the breadcrumb trails, it’s likely you want them to be terms in a custom taxonomy (or maybe a separate taxonomy for states and cities). Then, you will need to setup the term relationships (cities are children of states, homes are members of a city). Then, set for the house custom post type hierarchy to be that of the city taxonomy. Breadcrumb NavXT, as of version 6.5, I think this will work (otherwise, as of 7.0 I’m pretty sure it will work, but, 7.0 isn’t released yet).
Forum: Plugins
In reply to: [Breadcrumb NavXT] Hiding categories on certains category single postsIn general, I don’t recommend using hidden categories (use custom taxonomies, or custom post types instead). That said, you could write a hook into the
bcn_after_fillaction and iterate over the passed in$breadcrumb_trail->breadcrumbsarray, looking for a breadcrumb representing the category you want to hide. You’ll have to piece together some examples in the documentation and the code I provided as an example in this support thread: https://wordpress.org/support/topic/breadcrumbs-level-limit/If you don’t want to write any code, the uManager extension provides a toggle interface in the admin bar, and an interface in the post and term editors for enabling/disabling the display of terms, posts, and pages in the breadcrumb trail.
Forum: Plugins
In reply to: [Breadcrumb NavXT] Breadcrumbs level limitThe below code, in theory, probably does what you want. Note that I have not tested it so there may be a PHP warning/error message lurking in there.
add_action('bcn_after_fill', 'my_only_two'); function my_only_two($trail) { if(count($trail->breadcrumbs) > 4) { $breadcrumbs = $trail->breadcrumbs; krsort($breadcrumbs); $cat_count = 0; foreach($breadcrumbs as $key => $breadcrumb) { if(in_array('category', $breadcrumb->get_types())) { $cat_count++; if($cat_count >2) { unset($trail->breadcrumbs[$key]); } } } } }Forum: Plugins
In reply to: [Breadcrumb NavXT] Error message when trying to configure the settingsOk, really wish that it would have had line numbers as I’m really not sure what it’s upset with. Additionally, I’m having issues getting PHP8 installed (the package for my linux distro is broken and I haven’t had the time to fix it). This all said, I’m still going to look at this, it’s just taking longer than intended.
- This reply was modified 5 years, 1 month ago by John Havlik.
Looking on the linked page, it looks like your unlinked breadcrumb template for pages till doesn’t have the
<meta property=”url” content=”%link%”>. So either that was set but the breadcrumb trail isn’t actually being generated by Breadcrumb NavXT, or that setting never got updated (maybe the “save changes” button wasn’t pressed).Lastly, since it looks like you have the Yoast SEO schema data in your header, you may want to remove the schema.org breadcrumbList markup from the Breadcrumb NavXT generated breadcrumb trail. Otherwise, you will have two instances of essentially the same data and that may throw off the various checking tools.
Forum: Plugins
In reply to: [Breadcrumb NavXT] Adding breadcrumbs to PagesPages are the only post type that Breadcrumb NavXT treats in a special manner since they can be the root for any other post type. Hence, taxonomies aren’t really supported for pages. Since pages are a hierarchical post type, you really should be using the page parent functionality to organize the pages (instances of the page post type) within your site. If you need another post type that is organized by taxonomy terms, you will probably be better served by a Custom Post Type rather than shoehorning in functionality in the page post type.
Forum: Plugins
In reply to: [Breadcrumb NavXT] How to make some post as parent to other postsSo, within Post Parents, your going to need to modify the post_parents.php file. What you’re going to have to do is change the call to
wp_dropdown_pages, to a custom version of that grabs and displays posts (of the post post type) rather than pages. It’s a little bit of a pain that this is what has to be done, but there doesn’t appear to be a generic version ofwp_dropdown_pagesthat works for non-hierarchical post types. If you post type is hierarchical, then you can just change thepost_typeargument passed in.Otherwise, there may be other plugins that allow you to set posts as parents of other posts, I just have never gone out looking for them.
If you’re going to include BreadcrumbList markup for the unlinked breadcrumbs, make sure you’re using something like:
<span property="itemListElement" typeof="ListItem"> <span property="name">%htitle%</span> <meta property="url" content="%link%"> <meta property="position" content="%position%"> </span>as your unlinked breadcrumb template. The key thing your current unlinked templates are missing is the
<meta property="url" content="%link%">portion.Forum: Plugins
In reply to: [Breadcrumb NavXT] Error message when trying to configure the settingsSo, I’m assuming this is a PHP8 related error. Was there any additional information provided (file name/line numbers)? Right now PHP8 still isn’t marked stable on my Linux distribution of choice, so I have not migrated to it yet (just jumped through the hoops to install 8.0.5 on my testbed now). FYI, since it looks like you’re running PHP8, there is one other PHP8 compatibility issue with the current version of the REST controller. This has been fixed on the development branch for Breadcrumb NavXT 7.0 (targeting the release for before the end of this month).
Forum: Plugins
In reply to: [Breadcrumb NavXT] How to make some post as parent to other postsDepending on the exact behavior you want to see, there are two different ways to configure Breadcrumb NavXT for using posts with patents. One is to use just the post parent in the breadcrumb trail. To do this, within the Breadcrumb NavXT settings, under the “Post Types” tab, set “Post Hierarchy” to “Post Parent”. The other is to use the post parent first, using the “Post Hierarchy Use Parent First” setting under the “Post Types” tab.
Now, both these settings assume you have established a parent-child relationship for your posts. Breadcrumb NavXT doesn’t provide an interface to do this, but something like Post Parents (see https://github.com/mtekk/Post-Parents) does.
Forum: Plugins
In reply to: [Breadcrumb NavXT] Display Breadcrumb Nav WITHOUT inputting a banner titleHow are you trying to call the breadcrumb trail (are you calling
bcn_display(), using the included widget, or using the included Gutenberg block)? From what I can tell, it looks like the theme uses different code for when there is a banner with title, and when there isn’t a title. So, you may need to look into what the theme is doing there and add the call to the breadcrumb trail to the proper area for the banner without title code path/theme file.Forum: Plugins
In reply to: [Breadcrumb NavXT] Breadcrumbs level limitWell, there are a couple of ways you could achieve this. Using something like Order Bender to set a preferred category, and setting that to be the 2nd level category for each applicable post is one way of achieving this result. You could hook into the
bcn_after_fillaction, go through the breadcrumbs array and removing category breadcrumbs after there have been 2 (see https://mtekk.us/archives/guides/conditionally-remove-home/ for an example of removing a breadcrumb from the breadcrumb trail, you will just need more logic for figuring out what breadcrumb to remove).