[英]How to remove anchor tag from text when it prints in php / wordpress
我试图弄清楚如何删除将打印的单词包装到html页面的锚标记。 如:
<a href="something">blog</a>
而是简单地:
blog
我认为这与这两者有关:
%1$s
大部分是我的代码的这一部分:
// Prints the string, replacing the placeholders.
printf(
$posted_in,
get_the_category_list( ', ' ),
$tag_list,
get_permalink(),
the_title_attribute( 'echo=0' )
);
我做了一个新功能。
现在只是想弄清楚%1$s
为什么生成类别名称的锚标记版本,而不是纯文本格式?
我认为这也部分与此有关: = __
不太确定。 导致正常的类别引用: %s
不能代替%1$s
。
if ( ! function_exists( 'designconcepts_posted_under' ) ) :
/**
* Prints HTML with title information for the current single post (category title).
*
* @since Design Concepts 1.0
*/
function designconcepts_posted_under() {
// Retrieves tag list of current post, separated by commas.
$tag_list = get_the_tag_list( '', ', ' );
if ( $tag_list ) {
$posted_in = __( '%1$s', 'designconcepts' );
} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
$posted_in = __( '%1$s', 'designconcepts' );
} else {
$posted_in = __( '%1$s', 'designconcepts' );
}
// Prints the string, replacing the placeholders.
printf(
$posted_in,
get_the_category_list( ', ' ),
$tag_list,
get_permalink(),
the_title_attribute( 'echo=0' )
);
}
endif;
您是否尝试过“ strip_tags”? http://php.net/manual/zh/function.strip-tags.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.