How to remove anchor tag from text when it prints in php / wordpress
I'm trying to figure out how tor remove the anchor tag that wraps开发者_运维技巧 a printed word to the html page. Suchas:
<a href="something">blog</a>
instead to be just simply:
blog
I reckon it has something to do with both this:
%1$s
and mostly this part of my code:
// Prints the string, replacing the placeholders.
printf(
$posted_in,
get_the_category_list( ', ' ),
$tag_list,
get_permalink(),
the_title_attribute( 'echo=0' )
);
I made a new function.
Now just trying to figure out why %1$s
produces the anchor tag version of the category name instead of just the plain text format instead?
I'm thinking it partly has to do with this as well: = __
Not too sure. Cause the normal Category reference: %s
does not work either in place of %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;
Have you tried "strip_tags"? http://php.net/manual/en/function.strip-tags.php
精彩评论