This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
de:components-depending-on-the_page [2014/03/15 16:27] Lars [Komponentes in Abhängigkeit einer Seite] |
de:components-depending-on-the_page [2014/05/03 23:02] Lars [A System for Different Components on Different Pages] |
||
---|---|---|---|
Line 51: | Line 51: | ||
?></file> | ?></file> | ||
- | Make a component which will be the default component and call it say //default//. Make components for specific pages and name them to include the page slug of the page into which they are to be inserted, so name them say //content-about// and //content-contact//. Then call the component in your page template as follows: | + | Create a component which will be the default component and name it //default//. Create components for specific pages and name them to include the page slug of the page into which they should inserted, so name them e.g //content-about// and //content-contact//. Then trigger the component in your page template as described: |
<code php> | <code php> | ||
<?php if (component_exists('content-'.get_page_slug(false))) | <?php if (component_exists('content-'.get_page_slug(false))) |