AnsPress_Breadcrumbs_Widget::get_breadcrumbs()

Description #

Get breadcrumbs array

Source #

File: widgets/breadcrumbs.php

	public static function get_breadcrumbs() {
		$current_page = ap_current_page();
		$title        = ap_page_title();
		$a            = array();

		$a['base'] = array(
			'title' => ap_opt( 'base_page_title' ),
			'link'  => ap_base_page_link(),
			'order' => 0,
		);

		$current_page = $current_page ? $current_page : '';

		if ( is_question() ) {
			$a['page'] = array(
				'title' => get_the_title(),
				'link'  => get_permalink( get_question_id() ),
				'order' => 10,
			);
		} elseif ( 'ask' === $current_page ) {
			$a['page'] = array(
				'title' => get_the_title(),
				'link'  => ap_get_link_to( 'ask' ),
				'order' => 10,
			);
		} elseif ( 'activities' === $current_page ) {
			$a['page'] = array(
				'title' => get_the_title(),
				'link'  => ap_get_link_to( 'activities' ),
				'order' => 10,
			);
		} elseif ( 'base' !== $current_page && '' !== $current_page ) {
			$a['page'] = array(
				'title' => $title,
				'link'  => $current_page,
				'order' => 10,
			);
		}

		$a = apply_filters( 'ap_breadcrumbs', $a );

		return is_array( $a ) ? ap_sort_array_by_order( $a ) : array();
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment