• Resolved Luke

    (@danceyrselfclean_admin)


    Hi a question I have always had about conditional tags is do they require the else function?

    So some example code might look like this:

    if ( is_page_template('about.php') ) {
    	// Returns true when 'about.php' is being used.
    } else {
    	// Returns false when 'about.php' is not being used.
    }

    But could I get away with removing the else part and just keep if. Would this cause any issues?

    if ( is_page_template('about.php') ) {
    	// Returns true when 'about.php' is being used.
    }

    I have tried searching for the answer to this but examples always seem to have else included.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional tags’ is closed to new replies.