User Tools

Site Tools


components-depending-on-the_page

This is an old revision of the document!


Components Depending On The Page

If you would like a component to be displayed on only one page, that can be done by adding the following code to your theme's template.php file:

<?php if (return_page_slug()=='PAGE') get_component('COMPNAME'); ?>

Don't forget to replace PAGE with your page's slug and COMPNAME with the component's name.

Components Depending On The Parent Page

Now If you want a component to be displayed on pages of a specific parent page, you can do it in a similar way:

<?php if (get_parent(0)=='PAGE') get_component('COMPNAME'); ?>

Again, don't forget to replace PAGE with your page's slug and COMPNAME with the component's name.

Exluding components

If you would like to exclude a component from a page you could do that by replacing==” with “!=” in the code above.

How to Have Different sidebars

components-depending-on-the_page.1365454526.txt.gz · Last modified: 2013/04/19 14:53 (external edit)