I want parts/lesson-links.php
not to be included when get_the_lesson_contenttype()
equals to "Hint" or "Main Lesson".
So I did this:
<h2><?php echo get_the_lesson_contenttype(); ?></h2>
<?php if (get_the_lesson_contenttype() != 'Hints' || get_the_lesson_contenttype() != 'Main Lesson') { ?>
<?php
include( locate_template( 'parts/lesson-links.php' ) );
?>
<?php } ?>
But as you can see in this page: http://clo2015.chineselearnonline.com/lessoncontent/lesson-004-hints-and-tips/
parts/lesson-links.php
is still being added. What did I do wrong?
EDIT:
Strangely it works without the ||
, only adding Hint
:
<?php if (get_the_lesson_contenttype() != 'Hints') include( locate_template( 'parts/lesson-links.php' ) );?>
You mixed up your ANDS
or ORS
(pun intended (I'm not funny))
<h2>
<?php echo get_the_lesson_contenttype(); ?>
</h2>
<?php
if (get_the_lesson_contenttype() != 'Hints' && get_the_lesson_contenttype() != 'Main Lesson') {
include( locate_template( 'parts/lesson-links.php' ) );
}
?>
Lets take a look at some boolean operations! Here we gooooo.....
You said...
I want parts/lesson-links.php not to be included when get_the_lesson_contenttype() equals to "Hint" or "Main Lesson".
Well thats like...
if (get_the_lesson_contenttype() == "Hint" || get_the_lesson_contenttype() == "Main Lesson")
DONT INCLUDE
ACTIVATE NEGATION!!!!!!! (Basically flip EVERYTHING!)
if (get_the_lesson_contenttype() != "Hint" && get_the_lesson_contenttype() != "Main Lesson")
DOOOO INCLUDE