0

how can I put logo and site name in an unordered list? I am using a bootstrap subtheme !

1

For that, you're going to want a custom template file (.tpl.php in D7, .html.twig in D8).

In Drupal 8, the logo and site name are contained within Bootstrap's block--system-branding-block.html.twig; in Drupal 7, they're set in Bootstrap's page.tpl.php. If you go into that file, you can change how those elements are rendered - just wrap them in the necessary /

  • tags and you'll be good to go!

    • Thanks for quick answer. I am using drupal 7. I have tried to make modification to page.tpl.php, so it means I am on the right path, but, can I get more help on how exactly I can do that ? I am a begginer. Is this ok <header id="navbar" role="banner" class="<?php print $navbar_classes; ?>"> <div class="<?php print $container_class; ?>"> <div class="navbar-header"> <ul class= "list inline"> <?php if ($logo): ?> ... <?php endif; ?> <?php if (!empty($site_name)): ?> ..... – dmircead Jun 12 '17 at 18:11
    • Just make sure to wrap the whole thing in <ul> and each element (logo, sitename) in <li> and you should be good. It looks like your HTML should be good, but if you put it in a code block by editing your original answer, I can help a little better. My only warning - if you write the code this way and have the <ul> outside your <?php if ?> statements, the <ul> will always print (even when you don't have a title / logo). If you'll always have a title / logo, that's fine. If not, wrap the full <ul> in another - <?php if ($logo) || (!empty($site_name): ?> – Lauren G Jun 12 '17 at 19:06
    0

    Yes ! it worked ! thank you so much. Here is the modification I made. Thanks for pointing out about the position of ul

     `<header id="navbar" role="banner" class="<?php print $navbar_classes; ?>">
      <div class="<?php print $container_class; ?>">
        <div class="navbar-header">
         <?php if (!empty($logo) || !emtpy($site_name)): ?>
          <ul class="list-inline"> 
            <?php if ($logo): ?>
           <li> <a class="logo navbar-btn pull-right" href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>">
              <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
            </a></li>
    
          <?php endif; ?>
    
          <?php if (!empty($site_name)): ?>
            <li><a class="name navbar-brand pull-right" href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>"><?php print $site_name; ?></a></li>
          <?php endif; ?>
    
          <?php if (!empty($primary_nav) || !empty($secondary_nav) || !empty($page['navigation'])): ?>
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
              <span class="sr-only"><?php print t('Toggle navigation'); ?></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
          <?php endif; ?>
                </ul> 
        <?php endif; ?>
        </div>` 
    

    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.