【问题标题】:How can i remove the category description from the nav item's title attribute [closed]如何从导航项目的标题属性中删除类别描述[关闭]
【发布时间】:2017-08-15 06:46:46
【问题描述】:

我目前正在网站上工作https://barwareandmore.com.au

如果您单击左侧导航栏中的任何项目,然后将鼠标悬停在另一个项目上,您可以看到链接的标题属性包含该类别的描述。

此代码也反映在所有页面的源代码中(从而产生重复内容)

有没有办法可以从这些链接中删除标题属性?还是将它们设置为空值?

我正在使用达芬奇主题

对不起,我不能更具体,还是 wordpress 的新手,

感谢您的任何帮助/建议/建议:]

【问题讨论】:

    标签: wordpress attributes seo


    【解决方案1】:

    我确实下载了主题,并查看了它。

    转到您的主题文件,在我相信的products 文件夹中查找cat-menu.php,然后查找:

    $product_cat_menu = wp_list_categories( array(
    'taxonomy' => 'product_cat',
    'show_count' => 1,
    'hide_empty' => 1,
    'echo'=> 0,
    'title_li' => sprintf('<h3>%s</h3>', __('Categories', 'ami3')),
    'link_before' => '<span class="main-el-icon"></span>'
    ) );
    

    并添加到它'use_desc_for_title' =&gt; 0,它基本上告诉查询不要在标题中包含描述。所以最后会是:

    $product_cat_menu = wp_list_categories( array(
    'taxonomy' => 'product_cat',
    'show_count' => 1,
    'hide_empty' => 1,
    'echo'=> 0,
    'title_li' => sprintf('<h3>%s</h3>', __('Categories', 'ami3')),
    'link_before' => '<span class="main-el-icon"></span>',
    'use_desc_for_title' => 0
    ) );
    

    【讨论】:

    • 非常感谢阿里,它奏效了。我还必须在同一个文件的第二个数组中添加该行(从源代码中删除 title 属性,因为第一个数组只从前端删除了它。)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-02
    • 2019-12-25
    相关资源
    最近更新 更多