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_content
If you need to store it in a variable with html formatting do this
apply_filters('the_content',$post->post_content)
Don't know WP, but the implied naming convention would suggest get_the_content(). Additional googling reveals a variation get_the_content_with_formatting
An alternative would be however to wrap the_content() into ob_start() and ob_get_contents()+ob_end(). The latter returns any print output made until then.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With