1

I've a sub-menu like this:

enter image description here

I'm trying to build a custom theme, I just copied which contains following code:

<?php if ($main_menu || $secondary_menu): ?>
  <div id="navigation"><div class="section">
    <?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => t('Main menu'))); ?>
    <?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => t('Secondary menu'))); ?>
  </div></div> <!-- /.section, /#navigation -->
<?php endif; ?>

This is how its being displayed: Note that not even the HTML for child menu items are generated. http://i.snag.gy/0yAdk.jpg

Yes, I've Show as expanded option checked for "Publications".

PS: Why does drupal make even such simple things difficult. No wonder, its losing ground to wordpress.

2

Try this:

<?php
$menu_name = variable_get('menu_main_links_source', 'main-menu');
$tree = menu_tree($menu_name);
print drupal_render($tree);
?>

Also Drupal doesn't make things hard, you just don't understand it yet.

It is just a tool suited to specific tasks. If you just want to make a blog then don't use Drupal, just use Wordpress.

If however you want a very powerful CMF (Content management framework, not system) to create complex systems with lots of inter-related entities then continue to learn Drupal - I think it's the best tool for the job.

  • Hi I was aware of this method of displaying (copied it from another theme), but I didn't want to use it because, I wanted to add custom 'css classes' to <ul> & <li> elements – claws Feb 14 '14 at 17:53
  • 1
    You can still theme your menu. This this SO post: stackoverflow.com/questions/2317462/… – Felix Eve Feb 18 '14 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.