Display author bio box

if( !empty(get_the_author_meta(‘description’)) ){ echo get_the_author_meta(‘description’); } You can use empty() function to check the content entered or not.

different body classes for each category

If i understood what you are lookin for, this should work, it uses get_queried_object() function: // Adding categories name to body class on archives add_filter(‘body_class’,’add_category_to_body_class’); function add_category_to_body_class( $classes ) { // check if in category if ( is_category() ) { // get the queried object, in this case, a category object, and assigns to a … Read more

How to use if (is_page_template (”))

is_page_template() checks against post type templates specified by the theme using /** * Template Name: My Template */ at the top of the template file. Not any arbitrary template file. For this, you might wanna check out the answers over at Get name of the current template file. You could grab the code from the … Read more

Add disclaimer before certain posts and pages

Is there a better way to accomplish this using the affiliate tags on my posts? Definitely I would go for an easier option, not relying on plugins like Jetpack. Why don’t you try the has_tag function? Something like this: function tt_filter_the_content( $content ) { if (has_tag(‘affiliate’)) $custom_content=”YOUR MESSAGE”; $custom_content .= $content; return $custom_content; } add_filter( … Read more

Custom Field to post_title

You can achieve this using the save_post hook. save_post is an action triggered whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post by email. add_action( ‘save_post’, ‘wpse254017_set_post_title’, 10, 2 ); function wpse254017_set_post_title ( $post_id, $post ){ //This temporarily removes action to prevent infinite … Read more