2012-02-09, 04:45:24
Hello,
How could I make some components display in only some pages instead of all?
Thanks.
How could I make some components display in only some pages instead of all?
Thanks.
The following warnings occurred: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
|
Display components in specific page only.
|
2012-02-09, 04:45:24
Hello,
How could I make some components display in only some pages instead of all? Thanks.
2012-02-09, 05:14:38
You can insert in your template something like:
Code: <?php if (return_page_slug()=='thatpage') get_component('thatcomponent'); ?> ...Or you could use the DynPages plugin.
2012-02-09, 05:17:10
Thank you but I want the components to be on the sidebar, plus I have a lot of pages in my website.
2012-02-09, 05:28:24
If you give every component the same id as their corresponding page slugs, you can insert this in the sidebar:
Code: <?php get_component(return_page_slug()); ?>
2012-02-09, 05:44:57
I want to have one conponent for like twenty pages.
2012-02-09, 06:13:23
Do those pages have something in common? (same parent page, or some string in the page slug, ...)
If not, something like Code: <?php
2012-02-09, 06:14:51
Thank you.
Same parent actually.
2012-02-09, 06:46:15
Then it's easier:
Code: <?php if (get_parent(0)=='parentpage') get_component('componentname'); ?>
2012-02-09, 06:47:55
(This post was last modified: 2012-02-09, 08:01:46 by marvinobrador.)
Great, thanks. I figured it out and worked perfectly!!
2012-02-16, 00:39:35
my question to this topic is that how would i have a topic header in the sidebar identified as per page then the content that i want in that sidebar ?
2012-02-16, 01:20:09
leonku Wrote:my question to this topic is that how would i have a topic header in the sidebar identified as per page then the content that i want in that sidebar ?If I understood what you're asking, get the Exec-PHP plugin and put this in the sidebar component. Code: <?php get_page_title(); ?> |
« Next Oldest | Next Newest »
|