HEX
Server: LiteSpeed
System: Linux standart103.isimtescil.net 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: byildiz (11197)
PHP: 8.2.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/byildiz.com.tr/httpdocs/wp-content/themes/lumex/inc/custom-breadcrumbs.php
<?php
/**
 * Functions for implement Breadcrumbs for this theme
 *
 * @package lumex
 */

if ( ! function_exists( 'lumex_breadcrumbs' ) ) {
	function lumex_breadcrumbs( $page_id ) {
			$parent_page_id = wp_get_post_parent_id($page_id);
			$ui_classes = 'mil-jcc mil-w-100';
			
			// Start the breadcrumb with a link to your homepage
			echo '<ul class="mil-breadcrumbs ' . esc_attr( $ui_classes ) . '">';
			echo '<li><a href="' . esc_url( home_url( '/' ) ) . '" title="' . esc_attr( get_bloginfo( 'name' ) ) . '">' . esc_html__( 'Home', 'lumex' ) . '</a></li>';

			// If the current page is a static posts page, show its title.
			if ( ( is_home() || is_category() || is_singular( 'post' ) ) && get_option( 'page_for_posts', true ) ) {
				$blog_title = get_the_title( get_option( 'page_for_posts', true ) );
				$blog_link = get_the_permalink( get_option( 'page_for_posts', true ) );

				echo '<li><a href="' . esc_url( $blog_link ) . '" title="' . esc_attr( $blog_title ) . '">' . esc_html( $blog_title ) . '</a></li>';
			}

			if ( $parent_page_id ) {
				echo '<li><a href="' . esc_url( get_the_permalink( $parent_page_id ) ) . '">' . esc_html( get_the_title( $parent_page_id ) ) . '</a></li>';
			}

			// If Blog
			if ( is_singular( 'post' ) && get_field( 'blog_page', 'options' ) ) {
				echo '<li><a href="' . esc_url( get_the_permalink( get_field( 'blog_page', 'options' ) ) ) . '">' . esc_html( get_the_title( get_field( 'blog_page', 'options' ) ) ) . '</a></li>';
			}

			// If Portfolio
			if ( is_singular( 'portfolio' ) && get_field( 'portfolio_page', 'options' ) ) {
				echo '<li><a href="' . esc_url( get_the_permalink( get_field( 'portfolio_page', 'options' ) ) ) . '">' . esc_html( get_the_title( get_field( 'portfolio_page', 'options' ) ) ) . '</a></li>';
			}

			// If Services
			if ( is_singular( 'services' ) && get_field( 'services_page', 'options' ) ) {
				echo '<li><a href="' . esc_url( get_the_permalink( get_field( 'services_page', 'options' ) ) ) . '">' . esc_html( get_the_title( get_field( 'services_page', 'options' ) ) ) . '</a></li>';
			}

			// If Team
			if ( is_singular( 'team' ) && get_field( 'team_page', 'options' ) ) {
				echo '<li><a href="' . esc_url( get_the_permalink( get_field( 'team_page', 'options' ) ) ) . '">' . esc_html( get_the_title( get_field( 'team_page', 'options' ) ) ) . '</a></li>';
			}

			echo '<li class="mil-current"><a>';

			// Check if the current page is a category, an archive or a single page. If so show the category or archive name.
			if ( is_category() ){
				$category = get_the_category();

				if( $category ) {
					echo esc_html( $category[0]->cat_name );
				}
			} elseif ( is_post_type_archive( 'portfolio' ) ) {
				echo esc_html__( 'Portfolio', 'lumex' );
			} elseif ( is_post_type_archive( 'services' ) ) {
				echo esc_html__( 'Services', 'lumex' );
			} elseif ( is_archive() ){
				if ( is_day() ) {
					printf( __( '%s', 'lumex' ), get_the_date() );
				} elseif ( is_month() ) {
					printf( __( '%s', 'lumex' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'lumex' ) ) );
				} elseif ( is_year() ) {
					printf( __( '%s', 'lumex' ), get_the_date( _x( 'Y', 'yearly archives date format', 'lumex' ) ) );
				} elseif ( is_tag() ) {
					echo get_the_archive_title();
				} else {
					echo esc_html__( 'Archives', 'lumex' );
				}
			}

			// If the current page is a static page, show its title.
			if ( is_search() ) {
				printf( esc_html__( 'Search: %s', 'lumex' ), '' . get_search_query() . '' );
			}

			// If the current page is a static page, show its title.
			if ( is_page() || is_singular() ) {
				$category = get_the_category();

				if ( $category ) {
					$page_title = $category[0]->cat_name;
				} else {
					$page_title = get_the_title( $page_id );
				}
				if ( function_exists( 'get_field' ) ) {
					$bread_title = get_field( 'bread_title', $page_id );
					if ( $bread_title ) {
						$page_title = $bread_title;
					}
				}
				
				echo esc_html( $page_title );
			}

			echo '</a></li>';

			echo '</ul>';
	}
}