John Havlik
Forum Replies Created
-
Forum: Plugins
In reply to: [Breadcrumb NavXT] Remove breadcrumb from footer contentThis is very likely something your theme is doing then. Either it is calling
bcn_display()multiple times on a page, or it is applying thetha_breadcrumb_navigationfilter more than once (or doing both, which it should not be doing). Your best bet is to find where the theme is calling Breadcrumb NavXT and make your own version of that file in your child theme, ensuring only Breadcrumb NavXT is called once and where you want it to show up.Forum: Plugins
In reply to: [Breadcrumb NavXT] Move breadcrumbs to rightAdjusting the layout/appearance of the breadcrumb trail requires adding the appropriate CSS to your theme’s (or child theme’s) style.css. I suggest testing potential styling rules with your web browser’s built in inspector tool. Once you find something you’re happy with, implement it in your style.css and verify the changes in your browser.
Forum: Plugins
In reply to: [Breadcrumb NavXT] Rendering only to the top of the pageAs covered in the Breadcrumb NavXT documentation, the first parameter for
bcn_display()will have it return a string rather than echo the content. Thus, you probably want to usebcn_display(true)instead ofbcn_display().- This reply was modified 7 years, 4 months ago by John Havlik.
Forum: Plugins
In reply to: [Breadcrumb NavXT] Remove breadcrumb from footer contentHow are you calling the breadcrumb trail (e.g. are you using the included Widget, or are you calling
bcn_display()? I ask as what you are describing is not something Breadcrumb NavXT is doing by itself (something is calling it in two different locations for some reason).Breadcrumb NavXT uses the “Posts page” from Settings > Reading for the Blog breadcrumb URL. The easiest way to make this link to where you want is to update this setting in WordPress to link to the /blog page rather than /blog-old. If for some reason this is not feasible, you can write a filter for the
bcn_breadcrumb_urlhook and set the URL to what you want it to be.Forum: Plugins
In reply to: [Breadcrumb NavXT] Insert item between breadcrumb on specific pagesDon’t use
breadcrumb_trail->add()as that function automatically adds the breadcrumb to then end of the breadcrumb trail (well it will show up before all of the other breadcrumbs). Instead, use something like:$new_breadcrumb = new bcn_breadcrumb('Verhuur', NULL, array('verhuur'), '/verhuur/'); array_splice($breadcrumb_trail->breadcrumbs, -1, 0, $new_breadcrumb);Note that I have not tried executing the above, but I believe it should work (or close to working). Also, note that in the above use of
array_splicethe offset of -1 tells array_splice to start at the end of the array and count backwards.Forum: Plugins
In reply to: [Breadcrumb NavXT] change text of specific page in the trailInternally, there is only one title in Breadcrumb NavXT for each breadcrumb. If you just want to shorten the title shown in the breadcrumb trail so things fit nicely in your layout, consider using CSS to shorten the title (see https://mtekk.us/archives/guides/trimming-breadcrumb-title-lengths-with-css/).
Otherwise, there is another way of doing this that may help you do what you want. You could use
bcn_template_tagsto create your own template tag (either for the shortened or the un-shortened title). Then update your templates to use the new custom template tag.Forum: Plugins
In reply to: [Breadcrumb NavXT] Insert item between breadcrumb on specific pagesYou can manually add breadcrumbs to the trail by hooking into the
bcn_after_fillaction. An example of adding a breadcrumb to the beginning of the trail is covered in this article: https://mtekk.us/archives/guides/add-a-static-breadcrumb-to-the-breadcrumb-trail/However, for what you want to do, you can’t use
$breadcrumb_trail->add. Instead, you will want to use the PHParray_splicefunction to inject a newbcn_breadcrumbinstance just before the last member of the$breadcrumb_trail->breadcrumbsarray. You can check for the ID using$breadcrumb_trail->breadcrumbs[count($breadcrumb_trail->breadcrumbs)-2]->get_id(), though ensure you check the types as well to ensure it is of the correct type (e.g. post vs taxonomy, can retrieve the types array for a breadcrumb using theget_types()member function).Forum: Plugins
In reply to: [Breadcrumb NavXT] change text of specific page in the trailChecking against the
$idensures you replace the title only for the page in question.There isn’t a
$htitleparameter for thebcn_breadcrumb_titlefilter, so that won’t work. Changes made to the title usingbcn_breadcrumb_titlewill affect both%title%and%htitle%, there isn’t really a way around this.%title%is literally%htitle%run throughesc_attr()andstrip_tags().For creating a special new title for hovers, I’d suggest creating your own custom breadcrumb template tag using the
bcn_breadcrumb_tagsfilter. The documentation has a link to a simple example, you can use that as a starting point.Forum: Plugins
In reply to: [Breadcrumb NavXT] change text of specific page in the trail@rom174: For the specific issue on the home page, it is very likely that your home template had ‘Home’ in it rather than
%htitle%, that would cause the described behavior (it is also mentioned in the article you linked to under the ‘Consider the Following section).As for the actual problem you’re trying to solve, if you want to want to use a shorter title, this is the filter to use. However, the check against
$typeprobably isn’t appropriate here, you are better off checking$idagainst the desired post ID. Extending this concept further, you can write an interface for interacting with postmeta to store/grab the shorter title. If you don’t want to write this yourself, there is the Breadcrumb NavXT Title Trixx premium extension that provides this functionality.Forum: Plugins
In reply to: [Breadcrumb NavXT] No page category hierarchySince pages can be the root for other post types (e.g. ‘page for posts’ in WordPress core, and root pages in Breadcrumb NavXT), the page post type is treated in a special manner in Breadcrumb NavXT. Breadcrumb NavXT, at least what is exposed by the settings page, only allows pages to follow a post parent hierarchy. If you want to have a hierarchical post type follow a taxonomy term based hierarchy, you probably want to create a Custom Post Type to do that.
Forum: Plugins
In reply to: [Breadcrumb NavXT] change text of specific page in the trail@rom174: I strongly caution against modifying any of the files that Breadcrumb NavXT ships with as these modifications will get wiped out when you update the plugin.
I am confused as to how you were able to write a filter for
bcn_breadcrumb_titleand only affect the title showing up in the link title. The only way that should be possible is if you have a static title in the breadcrumb template (e.g. did not have %htitle% in youratag). Can you provide more information as to what you did and what markup you are seeing being generated by Breadcrumb NavXT?Well, that’s odd. Based on the output, there are really only two things I can think of that would cause this. Either the unlinked template is missing the
%htitle%tag, or the instance of the post that Breadcrumb NavXT gets is missing its title (e.g. tribe is doing something weird).To check for the first possibility, in the Breadcrumb NavXT settings page, can you look under the Post Types tab for the “Event Template (unlinked)” setting and see if it is different from the other custom post type unlinked templates?
Forum: Plugins
In reply to: [Breadcrumb NavXT] BreadcrumbList missing item in structured-data toolsAs far as I recall, Google does not recognize the current page as part of the breadcrumb trail (never shows up in SERPs). Google only detects breadcrumbs that have links (e.g. you need to enable the link current item option in Breadcrumb NavXT).
Forum: Plugins
In reply to: [Breadcrumb NavXT] Show only main selected categoryUnfortunately, the actual code you’d use is highly specific to the intended use case and UI you are integrating into. In general, you’d do something like the following:
add_filter('bcn_pick_post_term', 'my_bcn_pick_term_filter', 10, 4); function my_bcn_pick_term_filter($term, $id, $type, $taxonomy) { if($id === POST_IN_QUESTION) { //GET POST TERMS HERE //Set $term to desired term for post } return $term; }Note that there are items here that you will need to write (e.g. retrieving the terms for the post, dealing with the post in question check). This may even not be the way you want to do it (depending on how you’re dealing with the mapping).