I’m looking to figure out how could I show a link on the left menu of my website that would appear only when We are on the Home page.
It should looks like this, but only for the home page (look at the link called Recommended VoIP Service ) : http://abvoip.com/
Is that possible to do so directly in the admin panel ? otherwise, which file do I have to modify ? Cause I’m working in the default-widgets.php file, in the widget function, but I know it is not the way it is supposed to be …
Thanks
You can do this very easily by using a conditional tag. Conditional tags, like the
is_home()function, test to see whether the provided conditions are true or not. In this case, we are testing whether or not we are on the home page. If you place this within an if statement, the code inside that statement will only be executed ifis_home()is true.Take the following code for adding the “Recommended VoIP Service” to the sidebar:
This will effectively only display the “Recommended VoIP Service” list item when you are in fact on the home page.
You can find more information on wordpress conditional tags here: http://codex.wordpress.org/Conditional_Tags