Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
page level as function
#1
Hello,

I need a PHP snippet to find the current menu level of a page?

- index
-- first level page
--- second level page

A function that returns 2 called in the second level page?

Thank you!
Reply
#2
(2013-04-25, 18:10:58)netzfetz Wrote: I need a PHP snippet to find the current menu level of a page?

- index
-- first level page
--- second level page

A function that returns 2 called in the second level page?

If you use the I18N plugin for your navigation, you can use
Code:
<?php
  function getPageLevel() {
    $bc = return_i18n_breadcrumbs(return_page_slug());
    return count($bc)-1;
  }
?>
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
Ok, I understand -> count the number of breadcrumb items.
Thank you mvlcek!
Reply




Users browsing this thread: 1 Guest(s)