PHP code example of atomita / wp-breadcrumb-navigation

1. Go to this page and download the library: Download atomita/wp-breadcrumb-navigation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

atomita / wp-breadcrumb-navigation example snippets




use atomita\wordpress\BreadcrumbNavigationFacade;

BreadcrumbNavigationFacade::expandFunction();

the_breadcrumb_navigation(); // output breadcrumb



use atomita\wordpress\BreadcrumbNavigationFacade;

BreadcrumbNavigationFacade::expandFunction();

add_filter('breadcrumb-navigation-around-getlist', function($breadcrumb){
  $breadcrumb[] = [
    'url' => 'https://example.com',
    'title => 'home'
  ];
  $breadcrumb[] = [
    'url' => 'https://example.com/foo',
    'title => 'foo'
  ];
  return $breadcrumb;
});

the_breadcrumb_navigation(); // output breadcrumb

/* output
<div class="level-1 " itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
	<a href="https://example.com" itemprop="url">
		<span itemprop="title">home</span>
	</a> &gt;
	<div class="level-2 last" itemprop="child" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
		<a href="https://example.com/foo" itemprop="url">
			<span itemprop="title">foo</span>
		</a>
	</div>
</div>
*/