@80689248440

Как Breadcrumb NavXT отключить последний разделитель?

На сайте использую плагин Breadcrumb NavXT для хлебных крошек магазина на woocomerce, но задача стоит так чтоб поле в настройках "Товар Шаблон (некликабельная)" стоял пробел - то есть чтоб в крошках когда находишься в товаре не выводилось название товара а только рубрика.
Сейчас выводится:
Магазин > Рубрика > Подрубрика > Подрубрика > (должно быть название товара но мы его удалили в настройках заменив на пробел)

Нужно избавиться от последнего >
  • Вопрос задан
  • 653 просмотра
Пригласить эксперта
Ответы на вопрос 3
it_proger29
@it_proger29
Битрикс
.breadcrumbs__link.current-item:after {
    display: none;
}

Я вот так убрал.
Ответ написан
Комментировать
@Dracula_666
Пробел лучше не использовать. Создаешь файл breadcrumb_navxt_remove_curitm.php с кодом указанным ниже и копируешь этот файл в корневую папку модуля. Далее заходишь в админке сайта в раздел установленные плагины, там появляется плагин Breadcrumb NavXT Remove Current Item Extension, нажимаешь "Активировать". Тем самым у тебя удаляется последний разделитель с названием страницы (то, что ты пытался сделать через пробел).
Если у кого-то в разделе плагинов пишет, что имеется более свежая версия Breadcrumb NavXT Remove Current Item Extension и просит обновить - НЕ ОБНОВЛЯЙТЕСЬ! Просто в коде файла укажите актуальную вашу версию! Сейчас в файле значится версия - Version: 6.6.0.

<?php
/*
Plugin Name: Breadcrumb NavXT Remove Current Item Extension
Plugin URI: http://mtekk.us/code/breadcrumb-navxt/
Description: Removes the current item from the breadcrumb trail. For details on how to use this plugin visit <a href="http://mtekk.us/code/breadcrumb-navxt/">Breadcrumb NavXT</a>. 
Version: 6.6.0
Author: John Havlik
Author URI: http://mtekk.us/
*/
/*  Copyright 2012-2018  John Havlik  (email : john.havlik@mtekk.us)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
//Add in our action hook to run after the trail has been filled
add_action('bcn_after_fill', 'bcnext_remove_current_item');
/**
 * We're going to pop off the paged breadcrumb and add in our own thing 
 *
 * @param bcn_breadcrumb_trail $trail the breadcrumb_trail object after it has been filled
 */
function bcnext_remove_current_item($trail)
{
	//Check to ensure the breadcrumb we're going to play with exists in the trail
	if(isset($trail->breadcrumbs[0]) && $trail->breadcrumbs[0] instanceof bcn_breadcrumb)
	{
		$types = $trail->breadcrumbs[0]->get_types();
		//Make sure we have a type and it is a current-item
		if(is_array($types) && in_array('current-item', $types))
		{
			//Shift the current item off the front
			array_shift($trail->breadcrumbs);
		}
	}
}
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы