WordPress.org

Ready to get started?Download WordPress

Forums

Why won't this work? if (!is_single() || (!is_page())) (5 posts)

  1. nipponese
    Member
    Posted 3 years ago #

    I am having a problem using the OR operator in php

    <?php if (!is_single() || (!is_page())) {
    				echo "<a href=\"";
    				the_permalink();
    				echo "\">";
    			}
    
    			the_title();
    
    			if (!is_single()) {
    				echo "</a>";
    			}
    		?>

    PHP simply ignores the statement...

  2. Emil Uzelac
    Theme Review Admin
    Posted 3 years ago #

    Would it be easier just to remove the permalink from the page.php?

  3. nipponese
    Member
    Posted 3 years ago #

    In this case, I'm trying to write my whole template using only index.php for the body content.

  4. nipponese
    Member
    Posted 3 years ago #

    Ah, I see my logical error now. Returning a false to the !is_page will negate the !is_single... Thinking is hard. :(

  5. Emil Uzelac
    Theme Review Admin
    Posted 3 years ago #

    sometimes we think to hard, glad that you found the solution :)

Topic Closed

This topic has been closed to new replies.

About this Topic