Support » Plugin: Breadcrumb NavXT » .SVG version problems 6.6.0

  • alexim13

    (@alexim13)


    After updating the module to version 6.6.0 the code in the “Home link template” section does not work

    <a property="item" typeof="WebPage" title="Перейти к %title%." href="%link%" class="%type%" bcn-aria-current>
    <svg width="23px" height="20px" viewbox="0 0 23 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
    	<g transform="translate(-140.000000, -166.000000)" fill="#FFFFFF" fill-rule="nonzero">
    		<g transform="translate(120.000000, 47.750000)">
    			<g transform="translate(20.285714, 118.250000)">
    				<path d="M2.99,19.4141667 C2.99,19.4141667 2.97,19.9058333 3.45083333,19.9058333 C4.04916667,19.9058333 8.99416667,19.8991667 8.99416667,19.8991667 L9.0025,15.3566667 C9.0025,15.3566667 8.92416667,14.6083333 9.65,14.6083333 L11.9508333,14.6083333 C12.81,14.6083333 12.7575,15.3566667 12.7575,15.3566667 L12.7475,19.885 C12.7475,19.885 17.4375,19.885 18.1741667,19.885 C18.7841667,19.885 18.7566667,19.2733333 18.7566667,19.2733333 L18.7566667,10.8966667 L11.1083333,4.09416667 L2.99,10.8975 C2.99,10.8975 2.99,19.4141667 2.99,19.4141667 Z"></path>
    				<path d="M0,10.2641667 C0,10.2641667 0.688333333,11.5341667 2.1925,10.2641667 L11.1766667,2.66333333 L19.5991667,10.2166667 C21.3391667,11.4716667 21.9916667,10.2166667 21.9916667,10.2166667 L11.1766667,0.42 L0,10.2641667 Z"></path>
    				<polygon points="19.3941667 2.64583333 17.2283333 2.64583333 17.2375 5.27333333 19.3941667 7.10416667"></polygon>
    			</g>
    		</g>
    	</g>
    </g>
    </svg>
    </a>

    The module removes the code and remains

    <a property="item" typeof="WebPage" title="Перейти к %title%." href="%link%" class="%type%" bcn-aria-current>
    
    	
    		
    			
    				
    				
    				
    			
    		
    	
    
    </a>

    Previous versions worked

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author John Havlik

    (@mtekk)

    What version of Breadcrumb NavXT did you upgrade from? I ask as this would have been a problem for all modern versions of Breadcrumb NavXT (since 4.3.0 which was released 7 years ago).

    You will need to add the SVG tags and attributes to the allowed HTML tags for the breadcrumb templates. The following article covers how to use the bcn_allowed_html filter to add a tag and attributes to the allowed HTML tag list for breadcrumb templates: https://mtekk.us/archives/guides/how-to-add-li-and-other-tags-to-breadcrumb-templates/

    alexim13

    (@alexim13)

    Updated from version 6.5.0. Thanks, it worked.

    To file breadcrumb-navxt.php after the line $allowed_html = array( add:

    					'svg' => array(
    						'width' => true,
    						'height' => true,
    						'viewbox' => true,
    						'version' => true,
    						'xmlns' => true,
    						'xmlns:xlink' => true
    					),
    					'g' => array(
    						'stroke' => true,
    						'stroke-width' => true,
    						'fill' => true,
    						'fill-rule' => true,
    						'transform' => true
    					),
    					'path' => array(
    						'fill' => true,
    						'd' => true,
    						'fill-rule' => true
    					),
    					'polygon' => array(
    						'points' => true
    					),
    • This reply was modified 2 months ago by alexim13.
    alexim13

    (@alexim13)

    Can you somehow remove the last separator?

    Link template to … (non-clickable) a space is specified to hide the page title.

    • This reply was modified 2 months ago by alexim13.
    Plugin Author John Havlik

    (@mtekk)

    Modifying breadcrumb-navxt.php is absolutely the wrong thing to do. You need to follow the article I linked and create a site specific plugin that contains a function that hooks into the bcn_allowed_html filter. Otherwise, every time you update Breadcrumb NavXT you will experience this issue.

    As for removing the current item, use the remove current item extension: https://github.com/mtekk/Breadcrumb-NavXT-Extensions/blob/master/breadcrumb_navxt_remove_curitm.php This will work much better than using a space in the breacrumb templates.

    alexim13

    (@alexim13)

    In the file functions.php added and the tag began to work. How do I add the rest of the tags to the filter (<g>, <path>, <polygon>)?

    Can you write the code below?

    function my_bcn_allowed_html($allowed_html)
        {
    	$allowed_html ['svg'] = array(
    		'width' => true,
    		'height' => true,
    		'viewbox' => true,
    		'version' => true,
    		'xmlns' => true,
    		'xmlns:xlink' => true
    	);
    	return $allowed_html;
    	}
    add_filter('bcn_allowed_html', 'my_bcn_allowed_html');
    • This reply was modified 2 months ago by alexim13.
    Plugin Author John Havlik

    (@mtekk)

    The $allowed_html variable is an array, each key is for an HTML tag. So, you can use any method you like to add more keys. A simple way is to add more $allowed_html['KEY'] = array(); assignments.

    For example, the following should do what you want:

    function my_bcn_allowed_html($allowed_html)
    {
    	$allowed_html['svg'] = array(
    		'width' => true,
    		'height' => true,
    		'viewbox' => true,
    		'version' => true,
    		'xmlns' => true,
    		'xmlns:xlink' => true
    	);
    	$allowed_html['g'] = array(
    		'stroke' => true,
    		'stroke-width' => true,
    		'fill' => true,
    		'fill-rule' => true,
    		'transform' => true
    	);
    	$allowed_html['path'] = array(
    		'fill' => true,
    		'd' => true,
    		'fill-rule' => true
    	);
    	$allowed_html['polygon'] = array(
    		'points' => true
    	);
    	return $allowed_html;
    }
    add_filter('bcn_allowed_html', 'my_bcn_allowed_html');
    • This reply was modified 2 months ago by John Havlik. Reason: forgot code tags/ticks
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.