Astra_Breadcrumb_Trail::add_items()

Runs through the various WordPress conditional tags to check the current page being viewed. Once a condition is met, a specific method is launched to add items to the $items array.


Description


Return

(void)


Source

File: inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php

	protected function add_items() {

		// If viewing the front page.
		if ( is_front_page() ) {
			$this->add_front_page_items();
		}

		// If not viewing the front page.
		else {

			// Add the network and site home links.
			$this->add_network_home_link();
			$this->add_site_home_link();

			// If viewing the home/blog page.
			if ( is_home() ) {
				$this->add_blog_items();
			}

			// If viewing a single post.
			elseif ( is_singular() ) {
				$this->add_singular_items();
			}

			// If viewing an archive page.
			elseif ( is_archive() ) {

				if ( is_post_type_archive() ) {
					$this->add_post_type_archive_items();
				}
				elseif ( is_category() || is_tag() || is_tax() ) {
					$this->add_term_archive_items();
				}
				elseif ( is_author() ) {
					$this->add_user_archive_items();
				}
				elseif ( get_query_var( 'minute' ) && get_query_var( 'hour' ) ) {
					$this->add_minute_hour_archive_items();
				}
				elseif ( get_query_var( 'minute' ) ) {
					$this->add_minute_archive_items();
				}
				elseif ( get_query_var( 'hour' ) ) {
					$this->add_hour_archive_items();
				}
				elseif ( is_day() ) {
					$this->add_day_archive_items();
				}
				elseif ( get_query_var( 'w' ) ) {
					$this->add_week_archive_items();
				}
				elseif ( is_month() ) {
					$this->add_month_archive_items();
				}
				elseif ( is_year() ) {
					$this->add_year_archive_items();
				}
				else {
					$this->add_default_archive_items();
				}
			}

			// If viewing a search results page.
			elseif ( is_search() ) {
				$this->add_search_items();
			}

			// If viewing the 404 page.
			elseif ( is_404() ) {
				$this->add_404_items();
			}
		}

		// Add paged items if they exist.
		$this->add_paged_items();

		// Allow developers to overwrite the items for the breadcrumb trail.
		$this->items = array_unique( apply_filters( 'astra_breadcrumb_trail_items', $this->items, $this->args ) );
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.


User Contributed Notes

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