Bug with category name with round brackets ()

Posted in: Newspaper
Post count: 17

I use a list of categories on wordpress pages built with Tagdiv Composer, as well as on standard pages. The site uses the latest version of the theme Newspaper. The list of categories is displayed via shortcode:


function categories_list_shortcode () {
	$args = array(
		'show_option_all'    => '',
		'show_option_none'   => __('No categories'),
		'orderby'            => 'name',
		'order'              => 'ASC',
		'show_last_update'   => 0,
		'style'              => 'list',
		'show_count'         => 0,
		'hide_empty'         => 1,
		'use_desc_for_title' => 0,
		'child_of'           => 0,
		'feed'               => '',
		'feed_type'          => '',
		'feed_image'         => '',
		'exclude'            => '',
		'exclude_tree'       => '',
		'include'            => '',
		'hierarchical'       => 0,
		'title_li'           => '',
		'number'             => NULL,
		'echo'               => 0,
		'depth'              => 0,
		'current_category'   => 0,
		'pad_counts'         => 0,
		'taxonomy'           => 'category',
		'walker'             => 'Walker_Category' 
		);
	$categories_list = wp_list_categories( $args );
	return '<ul class="catslist">'. $categories_list . '</ul>';
}
add_shortcode('categories_list', 'categories_list_shortcode');

If there are round brackets in the category name, this category is not displayed correctly in the list (screen – http://joxi.ru/VrwbyPKu773gRA).

If I change the theme to another, then everything is displayed correctly.

I think the problem is in the filter:

/* ----------------------------------------------------------------------------
add span wrap for category number in widget
*/
add_filter('wp_list_categories', 'cat_count_span');
function cat_count_span($links) {
$links = str_replace(' (', '<span class="td-widget-no">', $links);
$links = str_replace(')', '</span>', $links);
return $links;
}

905-913 lines in /Newspaper/includes/wp_booster/td_wp_booster_functions.php

How to fix this problem?

  • This topic was modified 7 years by doo.
Post count: 35449

Hi,

Hi the above code is use only on Categories widget.
Why not use our Categories/tags list from tagDiv Composer ( https://www.screencast.com/t/CClABhpPT ) ?

Thank you for your understanding.

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.