I am building a child theme in Wordpress that needs some custom functionality (for an example, I want to show an author bio on things in the 'fiction' category, but not in the 'fiction-contest' category, though they otherwise look the same).
It seems that no matter how specific my templates are, eventually I run into one of two things:
the_content();
or
get_template_part( 'content', get_post_format() );
This is the part I want to have finer control over. Yet it seems I can only grab content as a big chunk. My workaround has been to style parts of the content as "display: none", depending on the template being used, but is there a way to conditionally change actual content returned by the above code? If so, how and where would I do that?
Either:
Don't put the author bio in the post content (use a Custom Field for example) and display it when appropriate. You don't have to touch the content then.
Write a filter for the_content that changes its content when you want.
http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content
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