Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Remove component from one page not working
#5
(2014-10-22, 14:10:04)inteq Wrote: 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

You can use the in_array() function to make it more slim.
First you create an array with your "blacklist-slugs", where no sidebar will be shown (or "whitelist-slugs", depends on what is less input):
PHP Code:
$noSidebar = array('page_without_sidebar1','page_without_sidebar2','page_without_sidebar3'); 
Then you check, the slug and output the sidebar:
PHP Code:
if( !in_array(return_page_slug(), $noSidebar) ) {
get_component('Sidebar');

Not tested, but it should work like this.
Reply


Messages In This Thread
RE: Remove component from one page not working - by moped - 2014-10-22, 17:46:33



Users browsing this thread: 1 Guest(s)