Multiple if statements issue
-
I am having a problem with multiple if statements. I am using && but it seems to only work for the first statement. The code is like such:
global $post; $args = array( 'post_id' => $post->ID ); $comment = get_comments( $args ); $user = wp_get_current_user(); if ( 3 <= count( $comment ) && $post->post_author == $user->ID) { echo do_shortcode( '[button]' ); } else { comment_form(); }
It basically stats that if there is less than 3 comments then show the comment form but if there is more than 3 and is the post author then show a button. The button shows but only if there are more than 3 comments. It doesn’t check if it is only the post author or not, like i want it to.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Multiple if statements issue’ is closed to new replies.