![]() |
get_grandparent ?! - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16) +--- Thread: get_grandparent ?! (/showthread.php?tid=7511) |
get_grandparent ?! - stwneu - 2015-08-27 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! RE: get_grandparent ?! - bluzer - 2015-08-28 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"? RE: get_grandparent ?! - stwneu - 2015-09-02 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 ![]() RE: get_grandparent ?! - Everyone - 2015-09-02 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'); ?> ? RE: get_grandparent ?! - stwneu - 2015-09-02 (2015-09-02, 18:23:18)Everyone Wrote: If I understand correctly, you'd like to have something like: 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.
RE: get_grandparent ?! - Carlos - 2015-09-02 Perhaps this: http://www.cyberiada.org/cnb/log/check-if-page-or-subpage-of/ http://get-simple.info/forums/showthread.php?tid=4004&pid=31864#pid31864 |