Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get_grandparent ?!
#1
Wink 
Hi all!

I'm usually calling my sidebars with something like:

PHP Code:
<?php if (get_parent(0)=='test' or return_page_slug()=='test'get_component('sidebar-test') ; ?>

Now I have a section where I have grandchildren and even grand-grand-children, which should also have the same sidebar. Since there isn't something like "get_grandparent", do you have a hint for me?

Thanks!
Reply
#2
Correct me if I am wrong but wouldn't/doesn't
<?php if (return_page_slug()=='page you want the side bar on' ) get_component('sidebar-name') ;?>
work - or do you have pages with the same name under different "parents"?
Reply
#3
That's right, but if I would do it this way, I would have to add a lot of pages, which is, why I'm looking for another way Undecided
Reply
#4
If I understand correctly, you'd like to have something like:


PHP Code:
<?php if( hasParent('test') || return_page_slug() == 'test'get_component('sidebar-test'); ?>

?
Reply
#5
(2015-09-02, 18:23:18)Everyone Wrote: If I understand correctly, you'd like to have something like:



PHP Code:
<?php if( hasParent('test') || return_page_slug() == 'test'get_component('sidebar-test'); ?>

?

To visualize it a little: 
I would like to add a certain sidebar to all children of "Main Element 2". If we have only one sub-level (Second level), the script I posted originally works just fine. But then "Third level" does not have the same sidebar.
  • Main Element 1 
  • MainElement 2
    - Second level
       - Third level
  • Main Element 3
Reply
#6
Perhaps this: http://www.cyberiada.org/cnb/log/check-i...ubpage-of/
http://get-simple.info/forums/showthread...4#pid31864
Reply




Users browsing this thread: 1 Guest(s)