I’m not a php developer. I can handle html and css and my goal is to become proficient with php and javascript but right now I dabble with the latter two. In this case, I added some code to functions.php to create a custom Author Info Box below every post. Here's the code at GIST.

The problem is that the author info box is also showing on a custom post type of single-professional.php. I do not want it there. Those pages provide a profile/description of each author. I only want the author info box to show on single posts (single.php). I’ve temporarily used CSS (display:none) to keep it from displaying on the wrong pages but I need to come up with a better solution. I need to get rid of it completely from those wrong pages to avoid ranking issues with search engines (perception of cloaking).

Any assistance with what the correct PHP code needs to be to show the author info box only on single.php posts and not on single-professional.php posts would be greatly appreciated. Thanks.

  • Are they sharing the same content-single.php or similar in the get_template_part()? – Cedon Mar 18 '17 at 0:49

Replace line #3 with this if ( is_single() && isset( $post->post_author ) && 'post' == get_post_type() )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.