更改类别链接以指向'#'而不是类别

时间:2016-12-12 23:52:42

标签: php html wordpress tags meta-tags

我似乎无法正确调整以下代码,以指示类别链接指向'#'而不是指向类别页面。任何建议将不胜感激!

if ( ! function_exists( 'theme_framework_post_cat' ) ) :
function theme_framework_post_cat() {
  if ( 'post' == get_post_type() ) {
    $categories_list = get_the_category_list( esc_html__( ', ', 'theme' ) );
    if ( $categories_list && theme_framework_categorized_blog() ) {
        printf( '<span class="cat-links">' . esc_html__( '%1$s', 'theme' ) . '</span>', $categories_list );
    }
  }
}
endif;

1 个答案:

答案 0 :(得分:0)

您可以尝试:

$categories_list = strip_tags(get_the_category_list( esc_html__( ', ', 'theme' ) ));

strip_tags()是一个PHP函数,它将删除get_the_category_list WP函数返回的所有标记。