为什么wordpress dymanic_sidebar在锚文本的title属性中显示类别描述?
问题描述:
我重构一个WordPress的网站,我有在function.php注册为侧边栏有些构件为什么wordpress dymanic_sidebar在锚文本的title属性中显示类别描述?
注册的侧边栏的一个大问题:
register_sidebar(array(
'name' => 'sidebar 1',
'id' => 'sidebar_1',
'before_title' => '<div class="box_sidebar_heading"><h4>'.WPEX_Theme_Options::get_theme_option('titolo_sidebar_1').'<span style="display: none;">',
'after_title' => '</span></h4></div>',
'before_widget' => '',
'after_widget' => '',
));
此栏必须显示一个类别列表,称为通过简单的功能
<?php
if (is_active_sidebar('sidebar_1')) : ?>
<div class="box_sidebar col-xs-12 col-sm-12 col-md-12">
<?php dynamic_sidebar('sidebar_1'); ?>
</div><!-- #primary-sidebar -->
<?php endif; ?>
在后台的每个类别都有一个由文本和图像组成的wysiwyg复杂的描述。
问题是生成类别的HTML列表的系统函数放在锚点的title =“”属性中,类别描述是在wysiwyg中的类别描述。
的结果是这样的:
<ul class="nav nav-list nav-stacked box_sidebar_list">
<li class="cat-item cat-item-6 current-cat"><a href="http://www.test-site.com/category/my-category/" title="
Title of the image
Title of the paragraph
Title of the footer
">My category</a>
</li>
</ul>
因为它是用来acorss的网站,我无法找到如何在标题中把另一variabile的文档,我不能删除该类别描述=” “的主播。
谢谢。
答
我已经找到了一个解决方案,完全去掉标题=“”属性,所以只是解决方案的一半,是一个标志use_desc_for_title
// prevent the category widget from using the category description as the list item title attribute
function sjc_disable_cat_desc_widget_list_titles ($cat_args) {
$cat_args[ 'use_desc_for_title' ] = 0;
return $cat_args;
}
add_filter('widget_categories_args', 'sjc_disable_cat_desc_widget_list_titles');
这是链接到我的网页找到解决方案use_desc_for_title flag