Support » Plugin: List category posts » Including conditional logic in a custom template

  • Thanks again for helping me with the user avatar issue. I was going to ask another question there but thought it would be better to open another thread.

    So, can we have conditional logic in the custom template? Let’s say I want to display the post thumbnail OR the user avatar if the post doesn’t have a featured image.

    This is not really a question since I figured it out (I guess):

      if ( has_post_thumbnail( $post_id ) ) {
        $lcp_display_output .= $this->get_thumbnail($post);
      }
      else {
        $lcp_display_output .= get_avatar( get_the_author_meta( 'ID' ), 150 );
      }

    Is there any cons to using conditional logic in the custom template? Does this significantly affects performance?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.