I want to introduce some code into sidebar.php dependant on whether the site was on the front page or not. ( I have a static front page and am using the front-page.php file ).
To cut a long story short, I have done some testing and I now have the following code in BOTH my front-page.php file and also in the sidebar.php file; but the two bits of code are displaying conflicting results. The same page is telling me both that I am on front page and not on front page at the same time. The reality is that I actually AM on front page so the question i have is this. Is there something wrong with using the tag is_front_page() in sidebar.php ?
if( is_front_page()) echo "you are on front page"; else echo "you are not on front page";