astra_breadcrumb()

Get the Breadcrumb.


Description


Source

File: addons/advanced-headers/classes/astra-breadcrumbs.php

	function astra_breadcrumb() {

		/* Set up the arguments for the breadcrumb. */
		$args = apply_filters(
			'astra_breadcrumb_defaults', array(
				'prefix'         => null,
				'suffix'         => null,
				'title'          => null,
				'home'           => __( 'Home', 'astra-addon' ),
				'delimiter'      => null,
				'front_page'     => false,
				'show_blog'      => false,
				'echo'           => true,
				'archive-prefix' => __( 'Archives for ', 'astra-addon' ),
				'author-prefix'  => __( 'Archives for ', 'astra-addon' ),
				'search-prefix'  => __( 'You searched for ', 'astra-addon' ),
				'404-title'      => __( 'Error 404: Page not found', 'astra-addon' ),
			)
		);

		/* Format the title. */
		$title     = ( ! empty( $args['title'] ) ? '<span class="breadcrumbs-title">' . $args['title'] . '</span>' : '' );
		$delimiter = ( ! empty( $args['delimiter'] ) ) ? "<span class='separator'>{$args['delimiter']}</span>" : "<span class='separator'>»</span>";
		/* Get the items. */

		$items = rdfa_breadcrumb_get_items( $args );
		if ( ! empty( $items ) ) {
			$breadcrumbs  = '<!-- Ast Breadcrumbs start -->';
			$breadcrumbs .= '<div class="ast-breadcrumbs" itemscope itemtype="http://schema.org/BreadcrumbList">';
			$breadcrumbs .= $args['prefix'];
			$breadcrumbs .= $title;
			$breadcrumbs .= join( " {$delimiter} ", $items );
			$breadcrumbs .= $args['suffix'];
			$breadcrumbs .= '</div>';
			$breadcrumbs .= '<!-- Ast breadcrumbs end -->';
			$breadcrumbs  = apply_filters( 'astra_breadcrumb', $breadcrumbs );
			if ( ! $args['echo'] ) {
				return $breadcrumbs;
			} else {
				echo $breadcrumbs;
			}
		}
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.