Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Remove component from one page not working
#4
Thank you for reply.
I want the Sidebar component to be present on all pages but on a few selected ones.

So far I discovered that:
if I comment out <?php get_component('sidebar'); ?>
and I add <?php if (return_page_slug()!='index') get_component('Sidebar'); ?>
I will get the Sidebar on all pages BUT index.

Now, if I want to remove the Sidebar from yet another page, my logic tells me that I should add another:
<?php if (return_page_slug()!='another_page') get_component('Sidebar'); ?>

But, if I do that, the Sidebar will be doubled on all pages and will appear once an the pages I want it removed.

One thing that does the trick is:
<?php if (return_page_slug()=='index') get_component('Sidebar'); ?>
<?php if (return_page_slug()=='another_page') get_component('Sidebar'); ?>
This way I will only get the Sidebar on those two pages but it is a bit hard to implement when one has a lot of pages Sad

Did I get it right?
Reply


Messages In This Thread
RE: Remove component from one page not working - by inteq - 2014-10-22, 14:10:04



Users browsing this thread: 2 Guest(s)