In order to configure the Breadcrumbs, an option type was created that contains all the necessary configuration options for this extension.
Note
This option is for internal use only. Do not use it for posts/terms options as it will not affect breadcrumbs functionality. It works only in the settings options, and should be used only once.
Usage example:
'breadcrumbs-option' => array(
'type' => 'breadcrumbs',
'label' => false,
'desc' => false,
)
fw_ext_breadcrumbs_render($separator = '>')
- use this function to render breadcrumbs in your template
<h3>My page</h3> <?php echo fw_ext_breadcrumbs_render( '>>' ) ?> <!-- Home >> Books >> PHP For Beginners -->Note
This function should be used only in the front-end area after WordPress
wp
action.
breadcrumbs.php
is the template where you can define how the breadcrumbs will be shown on the page. You can overwrite the default view with your own, by creating a breadcrumbs.php
file in the extension’s views
directory in the child theme.fw_ext_breadcrumbs_build
- in some cases you want to modify the breadcrumbs items that will be rendered, or a specific item. This filter allows you to modify the breadcrumbs items array before it will be rendered.
/** * @internal */ function _filter_my_custom_breadcrumbs_items( $items ) { // do some changes ... return $items; } add_filter( 'fw_ext_breadcrumbs_build', '_filter_my_custom_breadcrumbs_items' );
fw_ext_breadcrumbs_search_query
- this filter is used in the search archive template and it contains the search query word. In case you want to modify the word or customize it, like capitalizing it, use this filter.
/** * @internal */ function _filter_my_custom_breadcrumbs_search_word( $word ) { return strtoupper( $word ); } add_filter( 'fw_ext_breadcrumbs_search_query', '_filter_my_custom_breadcrumbs_search_word' );Note
This filter doesn’t affect the search query
fw_ext_breadcrumbs_date_day_format
- date format for day archives (d F Y
)fw_ext_breadcrumbs_date_month_format
- date format for day archives (F Y
)fw_ext_breadcrumbs_date_year_format
- date format for day archives (Y
)These 3 filters are used to modify the date format in date archives
/**
* @internal
*/
function _filter_my_custom_breadcrumbs_archive_date_format( $date_format ) {
return 'd, F Y';
}
add_filter( 'fw_ext_breadcrumbs_date_day_format', '_filter_my_custom_breadcrumbs_archive_date_format' );