GetSimple Support Forum

Full Version: i18n menu entries
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello forum!

I am running a template with an i18n menu on the side, which I configured using
Code:
get_i18n_navigation(return_page_slug(),0,99,I18N_SHOW_LANGUAGE)

This works well. However, many users of the template wish for a not-so-simple thing: They want dummy menu entries to structure their sites like this:

menu_entry1 -> links to page 1
sub_menu_entry1 -> links to page 2
menu_entry2 -> links to nothing, keeps old content displayed
sub_menu_entry_2 -> links to page 3

So, is it possible to have menu entries without a linked page (dummies),
in a way that the GetSimple users can edit these entries conveniently?

I've searched the net for a long time for this now, and I'm running out of keywords to query...
you mean dummy pages, or dummy parents.
Dummy parents. I searched for this term on the net and on this forum as well, zero results (besides this thread).
I think there is a plugin called child menus or something.
If you simply want to have the parent (ie landing) pages not pointing to a link, I did a custom function a while ago for a client; might work for you, eventually with some tweaking:

Code:
function i18nMenuNoLandingPages($links, $loop = 0) {
    $y = count($links);
    static $str = '';
    $str = $str . '<ul>';
    for ($x = 0; $x < $y ; $x++) {
      $item = $links[$x];
      $str = $str . '<li>';
      if ($item['haschildren']) {
        $str = $str . '<a>' . $item['title'] . '</a>';
        $str = i18nMenuNoLandingPages($item['children'], $loop++, $str);
      } else if ($item['haschildren'] === false) {
        $str = $str . '<a href="' . $item['url'] . '">' . $item['title'] . '</a>';
      }
      $str = $str . '</li>';
    }
    $str = $str . '</ul>';
    return $str;
  }

Launch like so:
Code:
$nav = return_i18n_menu_data(return_page_slug(),0,5,I18N_SHOW_NORMAL);
  i18nMenuNoLandingPages($nav);

The $loop variable is for the levels of nesting you want to make parent pages 'linkless'.
I also wrote some more comprehensive doc. on i18n nav: http://codepen.io/Webketje/full/VYbxmy/