I am using WooTheme’s Canvas theme and would like to “hardcode” in the [post_comments] shortcode into my theme. [post_comments] displays a comment link with comment count (ie Comments 10) in my post. Right now I am inserting the [post_comments] shortcode into my theme’s meta “Meta Manager”; however, this is not ideal for me as I have limited control over the placement of where the this shows up in my post. What type of function or such should I be looking for to do this within my .php files?
Thank you
Check out do_shortcode(): http://codex.wordpress.org/Function_Reference/do_shortcode
So your example would be:
What might be easier is to tap into the underlying comment functions:
http://codex.wordpress.org/Function_Reference/comments_number
You can also use
get_comments_number
which returns the value rather than printing it to the screen.This function however needs to be in the Loop for it to work, however I have a feeling it is.