Wrap anchor links in button tags

it looks like this is the section that is printing the navigation anchor links from an array, I just want to wrap them in <button> <button/> tags, but I can’t tell where to intercept the links?

Drupal 7
/sites/all/themes/opendrop/page.tpl.php

    <?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; ?>

Forget <button>, just use CSS to style it like one. And it’s much easier to overwrite CSS than a HTML template you can’t modify. (for example, bootstrap, foundation, etc. exclusively use CSS to apply button styles)

2 Likes

An anchor cannot be a child of a button element, that’s invalid HTML.
A button is a type of form input, and anchor is a hyperlink.
They have two different purposes.
So you use one or the other, whichever serves the purpose you require, you can’t have both.

4 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.