Conditional if statement ($post->ID == get_the_ID) not working
The expression will always be true. Take a look at get_the_ID(); function get_the_ID() { global $post; return $post->ID; } So your code is effectively running as; if ( $post->ID == $post->ID ) // always true! Instead, cache the ID of the main post in a variable, then compare that instead. <?php global $post; /** * … Read more