I don’t quite understand your request. Are you talking about something in the Breadcrumb NavXT settings screen? Are you wanting to grab the settings programmatically via PHP (not recommended)? Or, are you looking for something else?
I want to get all the options set from Breadcrumb NavXT settings.
Hi @mtekk,
Actually, I am trying to display the breadcrumb of one post on another page with the post ID. And I have been able to display breadcrumbs by post ID but currently using static settings. So for this, I need Breadcrumb NavXT settings.
I hope I can get some guidance on this.
I’m not sure how you currently doing this. So, I will point out the bcn_breadcrumb_trail::fill_REST($item) function which is likely an easier way to end up with the breadcrumb trail you want. You just need to pass in an instance of WP_Post, WP_Term, or WP_User (for a post, you’d use WP_Post, something like using the result of get_post(POST_ID) should work) and it will populate the breadcrumb trail (you’ll need to call a display function after). This should still use the settings from the settings page.
Currently, I am using the below code.
$bcn_breadcrumb_trail = new bcn_breadcrumb_trail();
$bcn_breadcrumb_trail->breadcrumbs = array();
$bcn_breadcrumb_trail->opt = array(
// Options array.
);
$bcn_breadcrumb_trail->fill_REST($post);
$breadcrumb_navxt = new breadcrumb_navxt( $bcn_breadcrumb_trail );
echo $breadcrumb_navxt->display( false, true, false, false, "<li%3\$s>%1\$s</li>\n", "<ul>%1\$s</ul>\n" );
When Options array is empty, it’s throwing error, and the breadcrumb structure is not as per the setting. I tried passing static data in the array, and it’s working fine. That’s why I am looking to get the options to pass them in the function.
@mtekk any comment on the above?