I use a lot the function:
get_search_query()
To get the value returned from searches and to be able to modify and use the string.
I need to know a function to get <?php the_content(); ?>
as a string or how to turn what that function returns into a string.
The content is just a simple word with paragraph tags but using that function I also get the tags, I want to get just the text so I can add it to a hyperlink.
I think you’re looking for
get_the_content()
, which is well documented: http://codex.wordpress.org/Function_Reference/the_contentIf you need to store it in a variable with html formatting do this
Don’t know WP, but the implied naming convention would suggest
get_the_content()
. Additional googling reveals a variation get_the_content_with_formattingAn alternative would be however to wrap the_content() into
ob_start()
andob_get_contents()+ob_end()
. The latter returns anyprint
output made until then.You should use get_the_content() in order to make get it into a string, which you can format.
Full list of things you can get using this method: