| Server IP : 213.186.33.4 / Your IP : 216.73.216.146 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www/wp-content/plugins/divi-pixel/includes/modules/Breadcrumbs/ |
Upload File : |
<?php
class DIPI_Breadcrumbs extends DIPI_Builder_Module
{
public $slug = 'dipi_breadcrumbs';
static protected $rendering = false;
protected $module_credits = array(
'module_uri' => 'https://divi-pixel.com/modules/breadcrumbs',
'author' => 'Divi Pixel',
'author_uri' => 'https://divi-pixel.com'
);
public function init()
{
$this->icon_path = plugin_dir_path(__FILE__) . "dp-breadcrumbs.svg";
$this->vb_support = 'on';
$this->name = esc_html__('Pixel Breadcrumbs', 'dipi-divi-pixel');
$this->main_css_element = '%%order_class%%.dipi_breadcrumbs';
$this->settings_modal_toggles = [
'general' => [
'toggles' => [
'settings' => esc_html__('Settings', 'dipi-divi-pixel'),
],
],
'advanced' => [
'toggles' => [
'home_icon' => esc_html__('Home Icon', 'dipi-divi-pixel'),
'item_style' => esc_html__('Item Style', 'dipi-divi-pixel'),
'active_item_style' => esc_html__('Active Item Style', 'dipi-divi-pixel'),
'hover_item_style' => esc_html__('Hover Item Style', 'dipi-divi-pixel'),
'separator' => esc_html__('Separator', 'dipi-divi-pixel'),
],
],
];
}
public function get_custom_css_fields_config()
{
$fields = [];
$fields['bc_items'] = array(
'label' => esc_html__('Breadcrumbs Items', 'dipi-divi-pixel'),
'selector' => '%%order_class%% .dipi-breadcrumb-item',
);
$fields['bc_items_link'] = array(
'label' => esc_html__('Breadcrumbs Items Link', 'dipi-divi-pixel'),
'selector' => '%%order_class%% .dipi-breadcrumb-item a',
);
$fields['bc_home'] = array(
'label' => esc_html__('Home Element', 'dipi-divi-pixel'),
'selector' => '%%order_class%% .dipi-breadcrumb-home',
);
$fields['bc_home_link'] = array(
'label' => esc_html__('Home Element Link', 'dipi-divi-pixel'),
'selector' => '%%order_class%% .dipi-breadcrumb-home a',
);
$fields['bc_current_item'] = array(
'label' => esc_html__('Current Item', 'dipi-divi-pixel'),
'selector' => '%%order_class%% .dipi-breadcrumb-current',
);
$fields['bc_separator'] = array(
'label' => esc_html__('Separator', 'dipi-divi-pixel'),
'selector' => '%%order_class%% .dipi-breadcrumb-separator',
);
return $fields;
}
public function get_fields()
{
$fields = [];
$fields["bc_custom_home"] = [
'label' => esc_html__('Enable Custom Homepage', 'dipi-divi-pixel'),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => esc_html__('Yes', 'dipi-divi-pixel'),
'off' => esc_html__('No', 'dipi-divi-pixel'),
),
'default_on_front' => 'off',
'toggle_slug' => 'settings',
];
$fields["bc_home_text"] = [
'label' => esc_html__('Homepage Text', 'dipi-divi-pixel'),
'type' => 'text',
'option_category' => 'basic_option',
'toggle_slug' => 'settings',
'depends_show_if' => 'on',
'depends_on' => [
'bc_custom_home'
],
];
$fields["bc_home_url"] = [
'label' => esc_html__('Homepage Url', 'dipi-divi-pixel'),
'type' => 'text',
'option_category' => 'basic_option',
'depends_show_if' => 'on',
'depends_on' => [
'bc_custom_home'
],
'toggle_slug' => 'settings'
];
$fields["bc_home_icon"] = [
'label' => esc_html__('Display Home Icon', 'dipi-divi-pixel'),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => esc_html__('Yes', 'dipi-divi-pixel'),
'off' => esc_html__('No', 'dipi-divi-pixel'),
),
'toggle_slug' => 'settings',
];
$fields["bc_home_size"] = [
'label' => esc_html__('Home Icon Size', 'dipi-divi-pixel'),
'type' => 'range',
'validate_unit' => true,
'default' => '16px',
'default_unit' => 'px',
'range_settings' => [
'min' => '0',
'max' => '100',
'step' => '1'
],
'depends_show_if' => 'on',
'depends_on' => [
'bc_custom_home'
],
'tab_slug' => 'advanced',
'toggle_slug' => 'home_icon'
];
$fields["bc_home_color"] = [
'label' => esc_html__('Home Icon Color', 'dipi-divi-pixel'),
'type' => 'color-alpha',
'depends_show_if' => 'on',
'tab_slug' => 'advanced',
'toggle_slug' => 'home_icon'
];
$fields["bc_hover_home_color"] = [
'label' => esc_html__('Home Hover Icon Color', 'dipi-divi-pixel'),
'type' => 'color-alpha',
'depends_show_if' => 'on',
'depends_on' => [
'bc_custom_home'
],
'tab_slug' => 'advanced',
'toggle_slug' => 'home_icon'
];
$fields['bc_separator'] = [
'label' => esc_html__('Separator', 'dipi-divi-pixel'),
'type' => 'select',
'option_category' => 'configuration',
'options' => [
'icon' => esc_html__('Icon', 'dipi-divi-pixel'),
'symbol' => esc_html__('Symbol', 'dipi-divi-pixel'),
],
'default' => 'icon',
'toggle_slug' => 'settings'
];
$fields["bc_separator_icon"] = [
'default' => '$',
'label' => esc_html__('Separator Icon', 'dipi-divi-pixel'),
'type' => 'select_icon',
'option_category' => 'button',
'class' => ['et-pb-font-icon'],
'depends_show_if' => 'icon',
'depends_on' => [
'bc_separator'
],
'toggle_slug' => 'settings',
];
$fields["bc_separator_sysmbol"] = [
'label' => esc_html__('Separator Symbol', 'dipi-divi-pixel'),
'type' => 'text',
'option_category' => 'basic_option',
'depends_show_if' => 'symbol',
'depends_on' => [
'bc_separator'
],
'toggle_slug' => 'settings',
];
$fields["bc_schema"] = [
'label' => esc_html__('Schema Markup', 'dipi-divi-pixel'),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => esc_html__('Yes', 'dipi-divi-pixel'),
'off' => esc_html__('No', 'dipi-divi-pixel'),
),
'toggle_slug' => 'settings',
];
$fields["bc_separator_size"] = [
'label' => esc_html__('Separator Size', 'dipi-divi-pixel'),
'type' => 'range',
'validate_unit' => true,
'default' => '16px',
'default_unit' => 'px',
'range_settings' => [
'min' => '0',
'max' => '100',
'step' => '1'
],
'tab_slug' => 'advanced',
'toggle_slug' => 'separator'
];
$fields["bc_separator_color"] = [
'label' => esc_html__('Separator Color', 'dipi-divi-pixel'),
'type' => 'color-alpha',
'default' => '#2c3d49',
'tab_slug' => 'advanced',
'toggle_slug' => 'separator'
];
$fields["bc_separator_space"] = [
'label' => esc_html__('Separator Space', 'dipi-divi-pixel'),
'type' => 'range',
'validate_unit' => true,
'default' => '5px',
'default_unit' => 'px',
'range_settings' => [
'min' => '0',
'max' => '100',
'step' => '1'
],
'tab_slug' => 'advanced',
'toggle_slug' => 'separator'
];
$fields["bc_item_bg_color"] = [
'label' => esc_html__('Background Color', 'et_builder'),
'type' => 'color-alpha',
'tab_slug' => 'advanced',
'toggle_slug' => 'item_style'
];
$fields['bc_item_padding'] = [
'label' => esc_html__('Item Padding', 'dipi-divi-pixel'),
'type' => 'custom_margin',
'option_category' => 'basic_option',
'mobile_options' => true,
'responsive' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'item_style'
];
$fields["bc_active_item_color"] = [
'label' => esc_html__('Background Color', 'et_builder'),
'type' => 'color-alpha',
'tab_slug' => 'advanced',
'toggle_slug' => 'active_item_style'
];
$fields['bc_active_item_padding'] = [
'label' => esc_html__('Active Item Padding', 'dipi-divi-pixel'),
'type' => 'custom_margin',
'option_category' => 'basic_option',
'mobile_options' => true,
'responsive' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'active_item_style'
];
$fields["bc_hover_item_bg_color"] = [
'label' => esc_html__('Background Color', 'et_builder'),
'type' => 'color-alpha',
'depends_show_if' => 'on',
'tab_slug' => 'advanced',
'toggle_slug' => 'hover_item_style'
];
$fields["__breadcrumbs"] = [
'type' => 'computed',
'computed_callback' => ['DIPI_Breadcrumbs', 'render_breadcrumbs'],
'computed_depends_on' => [
'bc_custom_home',
'bc_home_text',
'bc_home_url',
'bc_home_icon',
'bc_separator',
'bc_separator_icon',
'bc_separator_sysmbol'
]
];
return $fields;
}
public function get_advanced_fields_config()
{
$advanced_fields = [];
$advanced_fields["text"] = false;
$advanced_fields["text_shadow"] = false;
$advanced_fields["fonts"] = false;
$advanced_fields['margin_padding'] = [
'css' => [
'margin' => '%%order_class%%',
'padding' => '%%order_class%%',
'important' => 'all',
],
];
$advanced_fields["borders"]["items"] = [
'css' => [
'main' => [
'border_radii' => "%%order_class%% .dipi-breadcrumb-item a",
'border_styles' => "%%order_class%% .dipi-breadcrumb-item a",
],
],
'toggle_slug' => 'item_style',
];
$advanced_fields["borders"]["hover"] = [
'css' => [
'main' => [
'border_radii' => "%%order_class%% .dipi-breadcrumb-item:hover a",
'border_styles' => "%%order_class%% .dipi-breadcrumb-item:hover a",
],
],
'toggle_slug' => 'hover_item_style',
];
$advanced_fields["borders"]["active"] = [
'css' => [
'main' => [
'border_radii' => "%%order_class%% .dipi-breadcrumb-current",
'border_styles' => "%%order_class%% .dipi-breadcrumb-current",
],
],
'toggle_slug' => 'active_item_style',
];
$advanced_fields["box_shadow"]["items"] = [
'css' => [
'main' => "%%order_class%% .dipi-breadcrumb-item a",
],
'toggle_slug' => 'item_style',
];
$advanced_fields["box_shadow"]["hover"] = [
'css' => [
'main' => "%%order_class%% .dipi-breadcrumb-item:hover a",
],
'toggle_slug' => 'hover_item_style',
];
$advanced_fields["box_shadow"]["active"] = [
'css' => [
'main' => "$this->main_css_element .dipi-breadcrumb-current",
],
'toggle_slug' => 'active_item_style',
];
$advanced_fields["fonts"]["items"] = [
'css' => [
'main' => "%%order_class%% .dipi-breadcrumb-item, %%order_class%% .dipi-breadcrumb-item a",
],
'font_size' => [
'default' => '12px',
],
'line_height' => [
'range_settings' => [
'min' => '1',
'max' => '100',
'step' => '1',
],
],
'hide_text_align' => true,
'toggle_slug' => 'item_style',
];
$advanced_fields["fonts"]["hover"] = [
'css' => [
'main' => "%%order_class%% .dipi-breadcrumb-item:hover a",
],
'font_size' => [
'default' => '12px',
],
'line_height' => [
'range_settings' => [
'min' => '1',
'max' => '100',
'step' => '1',
],
],
'hide_text_align' => true,
'toggle_slug' => 'hover_item_style',
];
$advanced_fields["fonts"]["active"] = [
'css' => [
'main' => "%%order_class%% .dipi-breadcrumb-current, %%order_class%% .dipi-breadcrumb-current span",
'important' => 'all',
],
'font_size' => [
'default' => '12px',
],
'line_height' => [
'range_settings' => [
'min' => '1',
'max' => '100',
'step' => '1',
],
],
'hide_text_align' => true,
'toggle_slug' => 'active_item_style',
];
return $advanced_fields;
}
static function render_breadcrumbs( $args = array(), $conditional_tags = array(), $current_page = array() )
{
$bc_custom_home = (isset($args['bc_custom_home'])) ? $args['bc_custom_home'] : 'off';
$bc_home_text = (isset($args['bc_home_text'])) ? $args['bc_home_text'] : '';
$bc_home_url = (isset($args['bc_home_url'])) ? $args['bc_home_url'] : '';
$bc_separator = (isset($args['bc_separator'])) ? $args['bc_separator'] : 'icon';
$bc_separator_icon = (isset($args['bc_separator_icon'])) ? $args['bc_separator_icon'] : '';
$bc_separator_sysmbol = (isset($args['bc_separator_sysmbol'])) ? $args['bc_separator_sysmbol'] : '';
$is_home = et_fb_conditional_tag('is_home', $conditional_tags );
$is_front_page = et_fb_conditional_tag('is_front_page', $conditional_tags );
$is_single = et_fb_conditional_tag('is_single', $conditional_tags);
$post_id = isset($current_page['id']) ? (int) $current_page['id'] : 0;
$page_object = get_post($post_id);
$is_page = isset($page_object->post_type) && 'page' === $page_object->post_type;
$_post = get_post($post_id );
$parent_id = get_post( $_post->post_parent);
$bc_home_icon = (isset($args['bc_home_icon'])) ? $args['bc_home_icon'] : '';
if ( self::$rendering ) {
return '';
}
self::$rendering = true;
$separator = ($bc_separator == 'icon') ? sprintf('
<li class="dipi-breadcrumb-separator">
<span class="et-pb-icon dipi-separator-icon">
%1$s
</span>
</li>',
esc_attr(et_pb_process_font_icon($bc_separator_icon))) :
sprintf('
<li class="dipi-breadcrumb-separator">
<span class="dipi-separator-symbol">
%1$s
</span>
</li>
',
esc_attr($bc_separator_sysmbol)
);
$home_icon = $bc_home_icon == 'on' ? '<span class="et-pb-icon dipi-home-icon"></span>' : '';
ob_start();
?>
<?php if($is_home || $is_front_page) : ?>
<li class="dipi-breadcrumb-item dipi-breadcrumb-home">
<?php if($bc_custom_home == 'on') : ?>
<a href="<?php echo esc_url($bc_home_url); ?>">
<span>
<?php echo $home_icon; ?>
<?php echo $bc_home_text; ?>
</span>
</a>
<?php else : ?>
<a href="<?php echo esc_url(get_home_url()); ?>">
<span>
<?php echo $home_icon; ?>
<?php echo bloginfo('name'); ?>
</span>
</a>
<?php endif; ?>
</li>
<?php
else :
$position = 0;
?>
<li class="dipi-breadcrumb-item dipi-breadcrumb-home">
<?php if($bc_custom_home == 'on') : ?>
<a href="<?php echo esc_url($bc_home_url); ?>">
<span>
<?php echo $home_icon; ?>
<?php echo $bc_home_text; ?>
</span>
</a>
<?php else : ?>
<a href="<?php echo esc_url(get_home_url()); ?>">
<span>
<?php echo $home_icon; ?>
<?php echo bloginfo('name'); ?>
</span>
</a>
<?php endif; ?>
</li>
<?php echo $separator; ?>
<?php if($is_page && !$parent_id) : ?>
<li class="dipi-breadcrumb-item dipi-breadcrumb-current">
<span><?php echo get_the_title($post_id); ?></span>
</li>
<?php elseif($is_page && $parent_id) :
$parents = get_post_ancestors($post_id);
foreach(array_reverse($parents) as $pageID) :
$position += 1;
// if($position > 2) echo $separator;
?>
<li class="dipi-breadcrumb-item">
<span>
<a href="<?php esc_url(the_permalink($pageID)); ?>">
<?php echo get_the_title( $pageID ); ?>
</a>
</span>
</li>
<?php echo $separator; endforeach; ?>
<li class="dipi-breadcrumb-item dipi-breadcrumb-current">
<span>
<?php echo get_the_title(); ?>
</span>
</li>
<?php else : ?>
<li class="dipi-breadcrumb-item dipi-breadcrumb-current">
<span>
<?php echo get_the_title($post_id); ?>
</span>
</li>
<?php
endif;
endif;
$breadcrumb = ob_get_contents();
ob_end_clean();
self::$rendering = false;
$output = sprintf(
'<ul> %1$s </ul>',
$breadcrumb
);
return $output;
}
public function render($attrs, $content = null, $render_slug)
{
$bc_custom_home = $this->props['bc_custom_home'];
$bc_home_text = $this->props['bc_home_text'];
$bc_home_url = $this->props['bc_home_url'];
$bc_home_size = $this->props['bc_home_size'];
$bc_home_color = $this->props['bc_home_color'];
$bc_home_icon = $this->props['bc_home_icon'];
$bc_hover_home_color = $this->props['bc_hover_home_color'];
$bc_separator = $this->props['bc_separator'];
$bc_separator_icon = $this->props['bc_separator_icon'];
$bc_separator_sysmbol = $this->props['bc_separator_sysmbol'];
$bc_separator_size = $this->props['bc_separator_size'];
$bc_separator_color = $this->props['bc_separator_color'];
$bc_separator_space = $this->props['bc_separator_space'];
$bc_item_bg_color = $this->props['bc_item_bg_color'];
$bc_hover_item_bg_color = $this->props['bc_hover_item_bg_color'];
$bc_active_item_color = $this->props['bc_active_item_color'];
$bc_schema = $this->props['bc_schema'];
\ET_Builder_Element::set_style($render_slug, [
'selector' => '%%order_class%% .dipi-separator-icon, %%order_class%% .dipi-separator-symbol',
'declaration' => "font-size: {$bc_separator_size};"
]);
\ET_Builder_Element::set_style($render_slug, [
'selector' => '%%order_class%% .dipi-separator-icon, %%order_class%% .dipi-separator-symbol',
'declaration' => "color: {$bc_separator_color};"
]);
\ET_Builder_Element::set_style($render_slug, [
'selector' => '%%order_class%% .dipi-separator-icon, %%order_class%% .dipi-separator-symbol',
'declaration' => "margin-right: {$bc_separator_space}; margin-left: {$bc_separator_space};"
]);
\ET_Builder_Element::set_style($render_slug, [
'selector' => '%%order_class%% .dipi-breadcrumb-home .dipi-home-icon',
'declaration' => "font-size: {$bc_home_size};"
]);
\ET_Builder_Element::set_style($render_slug, [
'selector' => "%%order_class%% .dipi-home-icon, %%order_class%% .dipi-home-icon:before",
'declaration' => "color: {$bc_home_color} !important;"
]);
\ET_Builder_Element::set_style($render_slug, [
'selector' => '%%order_class%% .dipi-breadcrumb-home:hover .dipi-home-icon, %%order_class%% .dipi-breadcrumb-home:hover .dipi-home-icon:before',
'declaration' => "color: {$bc_hover_home_color} !important;"
]);
\ET_Builder_Element::set_style($render_slug, [
'selector' => '%%order_class%% .dipi-breadcrumb-item a',
'declaration' => "background-color: {$bc_item_bg_color};"
]);
$bc_item_padding = explode('|', $this->props['bc_item_padding']);
$bc_item_padding_tablet = explode('|', $this->props['bc_item_padding_tablet']);
$bc_item_padding_phone = explode('|', $this->props['bc_item_padding_phone']);
$bc_item_padding_last_edited = $this->props['bc_item_padding_last_edited'];
$bc_item_padding_responsive_status = et_pb_get_responsive_status($bc_item_padding_last_edited);
if( '' !== $bc_item_padding) {
ET_Builder_Element::set_style( $render_slug, array(
'selector' => "%%order_class%% .dipi-breadcrumb-item:not(.dipi-breadcrumb-current) a",
'declaration' => sprintf( 'padding-top: %1$s !important; padding-right:%2$s !important; padding-bottom:%3$s !important; padding-left:%4$s !important;', $bc_item_padding[0], $bc_item_padding[1], $bc_item_padding[2], $bc_item_padding[3]),
) );
}
if( '' !== $bc_item_padding_tablet && $bc_item_padding_responsive_status) {
ET_Builder_Element::set_style( $render_slug, array(
'selector' => "%%order_class%% .dipi-breadcrumb-item:not(.dipi-breadcrumb-current) a",
'declaration' => sprintf( 'padding-top: %1$s !important; padding-right:%2$s !important; padding-bottom:%3$s !important; padding-left:%4$s !important;', $bc_item_padding_tablet[0], $bc_item_padding_tablet[1], $bc_item_padding_tablet[2], $bc_item_padding_tablet[3]),
'media_query' => ET_Builder_Element::get_media_query('max_width_980')
));
}
if( '' !== $bc_item_padding_phone && $bc_item_padding_responsive_status) {
ET_Builder_Element::set_style( $render_slug, array(
'selector' => "%%order_class%% .dipi-breadcrumb-item:not(.dipi-breadcrumb-current) a",
'declaration' => sprintf( 'padding-top: %1$s !important; padding-right:%2$s !important; padding-bottom:%4$s !important; padding-left:%4$s !important;', $bc_item_padding_phone[0], $bc_item_padding_phone[1], $bc_item_padding_phone[2], $bc_item_padding_phone[3]),
'media_query' => ET_Builder_Element::get_media_query('max_width_767')
));
}
$bc_active_item_padding = explode('|', $this->props['bc_active_item_padding']);
$bc_active_item_padding_tablet = explode('|', $this->props['bc_active_item_padding_tablet']);
$bc_active_item_padding_phone = explode('|', $this->props['bc_active_item_padding_phone']);
$bc_active_item_padding_last_edited = $this->props['bc_active_item_padding_last_edited'];
$bc_active_item_padding_responsive_status = et_pb_get_responsive_status($bc_active_item_padding_last_edited);
if( '' !== $bc_active_item_padding) {
ET_Builder_Element::set_style( $render_slug, array(
'selector' => '%%order_class%% .dipi-breadcrumb-current',
'declaration' => sprintf( 'padding-top: %1$s !important; padding-right:%2$s !important; padding-bottom:%3$s !important; padding-left:%4$s !important;', $bc_active_item_padding[0], $bc_active_item_padding[1], $bc_active_item_padding[2], $bc_active_item_padding[3]),
) );
}
if( '' !== $bc_active_item_padding_tablet && $bc_active_item_padding_responsive_status) {
ET_Builder_Element::set_style( $render_slug, array(
'selector' => '%%order_class%% .dipi-breadcrumb-current',
'declaration' => sprintf( 'padding-top: %1$s !important; padding-right:%2$s !important; padding-bottom:%3$s !important; padding-left:%4$s !important;', $bc_active_item_padding_tablet[0], $bc_active_item_padding_tablet[1], $bc_active_item_padding_tablet[2], $bc_active_item_padding_tablet[3]),
'media_query' => ET_Builder_Element::get_media_query('max_width_980')
));
}
if( '' !== $bc_active_item_padding_phone && $bc_active_item_padding_responsive_status) {
ET_Builder_Element::set_style( $render_slug, array(
'selector' => '%%order_class%% .dipi-breadcrumb-current',
'declaration' => sprintf( 'padding-top: %1$s !important; padding-right:%2$s !important; padding-bottom:%4$s !important; padding-left:%4$s !important;', $bc_active_item_padding_phone[0], $bc_active_item_padding_phone[1], $bc_active_item_padding_phone[2], $bc_active_item_padding_phone[3]),
'media_query' => ET_Builder_Element::get_media_query('max_width_767')
));
}
\ET_Builder_Element::set_style($render_slug, [
'selector' => '%%order_class%% .dipi-breadcrumb-item:hover a',
'declaration' => "background-color: {$bc_hover_item_bg_color}!important;"
]);
\ET_Builder_Element::set_style($render_slug, [
'selector' => '%%order_class%% .dipi-breadcrumb-current',
'declaration' => "background-color: {$bc_active_item_color}!important;"
]);
global $post;
$post_id = get_the_ID();
$parent_id = ($post) ? $post->post_parent : '';
if ( self::$rendering ) {
return '';
}
self::$rendering = true;
$schema_item_list = '';
$schema_item_list_element = '';
$schema_item = '';
$schema_item_name = '';
if('on' == $bc_schema ) :
$schema_item_list = 'itemscope itemtype="http://schema.org/BreadcrumbList"';
$schema_item_list_element = 'itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"';
$schema_item = 'itemprop="item"';
$schema_item_name = 'itemprop="name"';
endif;
$separator = ($bc_separator === 'icon' ) ? sprintf('
<li class="dipi-breadcrumb-separator"><span class="et-pb-icon dipi-separator-icon">%1$s</span></li>',
esc_attr(et_pb_process_font_icon($bc_separator_icon))
) : sprintf('
<li class="dipi-breadcrumb-separator">
<span class="dipi-separator-symbol">%1$s</span>
</li>', $bc_separator_sysmbol);
$home_icon = ($bc_home_icon == 'on') ? '<span class="et-pb-icon dipi-home-icon"></span>' : '';
ob_start();
?>
<?php if ( is_home() || is_front_page() ) : ?>
<li <?php echo $schema_item_list_element; ?> class="dipi-breadcrumb-item dipi-breadcrumb-home">
<?php if($bc_custom_home == 'on') : ?>
<a <?php echo $schema_item; ?> href="<?php echo $bc_home_url; ?>">
<span <?php echo $schema_item_name; ?>>
<?php echo $home_icon; ?>
<?php echo $bc_home_text; ?>
</span>
</a>
<?php else : ?>
<a href="<?php echo get_home_url(); ?>">
<span <?php echo $schema_item_name; ?>>
<?php echo $home_icon; ?>
<?php echo bloginfo('name'); ?>
</span>
</a>
<?php endif; ?>
</li>
<?php else :
$position = 0;
?>
<li <?php echo $schema_item_list_element; ?> class="dipi-breadcrumb-item dipi-breadcrumb-home">
<?php if($bc_custom_home == 'on') : ?>
<a <?php echo $schema_item; ?> href="<?php echo $bc_home_url; ?>">
<span <?php echo $schema_item_name; ?> >
<?php echo $home_icon; ?>
<?php echo $bc_home_text; ?>
</span>
</a>
<?php else : ?>
<a <?php echo $schema_item; ?> href="<?php echo get_home_url(); ?>">
<span <?php echo $schema_item_name; ?>>
<?php echo $home_icon; ?>
<?php echo bloginfo('name'); ?>
</span>
</a>
<?php
endif;
if('on' == $bc_schema ) :
?>
<meta itemprop="position" content="1" />
<?php
endif;
?>
</li>
<?php echo $separator; ?>
<?php if(is_page() && !$parent_id ) : ?>
<li <?php echo $schema_item_list_element; ?> class="dipi-breadcrumb-item dipi-breadcrumb-current">
<span <?php echo $schema_item_name; ?>>
<?php echo get_the_title(); ?>
</span>
</li>
<?php elseif(is_page() && $parent_id) :
$parents = get_post_ancestors( get_the_ID() );
foreach ( array_reverse( $parents ) as $pageID ) :
$position += 1;
if($position > 1) echo $separator;
?>
<li <?php echo $schema_item_list_element; ?> class="dipi-breadcrumb-item">
<a <?php echo $schema_item; ?> href="<?php echo get_page_link( $pageID ); ?>">
<span <?php echo $schema_item_name; ?>>
<?php echo get_the_title( $pageID ); ?>
</span>
</a>
</li>
<?php endforeach; echo $separator; ?>
<li <?php echo $schema_item_list_element; ?> class="dipi-breadcrumb-item dipi-breadcrumb-current">
<span <?php echo $schema_item_name; ?>>
<?php echo get_the_title(); ?>
</span>
</li>
<?php else : ?>
<li <?php echo $schema_item_list_element; ?> class="dipi-breadcrumb-item dipi-breadcrumb-current">
<span <?php echo $schema_item_name; ?>>
<?php echo get_the_title( $post_id ); ?>
</span>
</li>
<?php
endif;
endif;
$breadcrumb = ob_get_contents();
ob_end_clean();
self::$rendering = false;
$output = sprintf(
'<div class="dipi-breadcrumbs">
<ul %2$s>
%1$s
</ul>
</div>',
$breadcrumb,
$schema_item_list
);
return $output;
}
}
new DIPI_Breadcrumbs;