I have a view that outputs list items as links. Like so

  • Link 1
  • Link 2
  • Link 3
  • Link 4
  • I need to be able to wrap those items in

    <nav class="customclass">

    And close them. However when I attempt to do this in the template. Or in a basic page that is using a function to display the view.

    When I attempt

    <nav class="customclass">
            <?php print views_embed_view('mobile_slide_menu','block');?>

    I end up with

    <nav class="customclass"><ul>
        <div class="view-content mm-panel" id="mm-m0-p1">
          <div class="container">          
              <li><a href="example.com">Link 1</a></li>        
              <li><a href="example.com">Link 2</a></li>        
              <li><a href="example.com">Link 3</a></li>        
              <li><a href="example.com">Link 4</a></li>

    Which doesn't work for my list. Is there any way to take only the list items and prevent it from being wrapped in all those containers. And if not is there a way to append the opening and closing tags of 'nav' and 'ul' within the view?

    2 Answers 2


    A tutorial with more detail can be found here tutorial. But in short what you want to do is the following:

    Find the correct .tpl file and copy it into your theme. Edit the .tpl in your theme and remove the wrappers. Don't forget to flush caches after inserting a new template. All the template files are in the sites/all/modules/views/theme folder (depending on where exactly you installed views). There are quite a lot of them and the view templating is quite complex, luckily views helps you with a list to find the right one.

    You can find the list of template names you can use in the views interface (where you edit your view) under the advanced tab. Look for the Theme: information item. Clicking it will give you the list of all the .tpl files this view would use if able (ordered from most general to most specific and highlights the current one).


    Be as specific as possible to prevent accidentally breaking other views (rename the template file if to match the name in the list). more about the view templates


    To remove extra views container markups

    On your view's edit page. Under Format click on the 1st settings and uncheck Add views row classes and Add striping (odd/even), first/last row classes

    Also, on the 2nd settings, uncheck Provide default field wrapper elements

    Lastly, click on your field, and under STYLES SETTINGS make sure everything is unchecked

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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