is_home() and is_front_page() doesn't work in Wordpress Widget Logic plugin
-
21-12-2019 - |
Question
I'm trying to show AdRotate content just in the main page of my blog by using this conditional tags: is_home() && is_front_page()
also this other too is_home() || is_front_page()
and didn't work. If I do this in header.php
: echo is_home();
I get 1 as result which make me think that's TRUE. Also if I try with echo is_front_page()
I get the same result. What is wrong then?
Solution
is_home() && is_front_page()
will always be false. The two are mutually exclusive. The second version is the correct usage: is_home() || is_front_page()
. Are you aware of the difference between is_home()
and is_front_page()
?
Take a look at the plugin FAQ page for more info on homepage usage: http://wordpress.org/plugins/widget-logic/faq/
Also further reading on the conditionals you're attempting to use: http://codex.wordpress.org/Function_Reference/is_home http://codex.wordpress.org/Function_Reference/is_front_page