Adding Nested Links to your sidebar in WordPress

Default and older WordPress themes use nested lists to present their sidebar information. A nested list is simply a list of unordered items inside one another. A simple example of a nested list is below:

  • Flowers
    • Lilies
    • Roses
  • Dogs
    • Boxer
    • Poodle

You may have your own nested lists you wish to add to your sidebar for your selected WordPress theme. This article demonstrates how to add nested lists of items into your theme’s sidebar. Note this example uses the Twenty Twelve default theme found in WordPress 3.5

  1. Log into your WordPress Admin dashboard.
  2. Once logged into the Admin area, look to the left hand menu and click on the Appearance mneu category. This will reveal several sub-options. Click on the Editor option to continue.
  3. You are now on the main Editor page for all php and css files for your theme. Look to the menu on the right-hand side, scroll down until you see the Sidebar option. Click on that link to open the sidebar.php file in the editor.
    select editor menu option

  4. Once the file opens you will see the php code that governs the sidebar display and behavior. The highlighted line of code below is the code that calls the widgets. To add a nested list before the widgets, you will add your code before this line. To add the nested list after the widgets, add the code after the line. We will add the same list as above to our sidebar. The exact code for that list is below.
    sidebar code editor

    <ul style="list-style-type: disc;">
            <ul style="margin-left: .5em;">
            <ul style="margin-left: .5em;">

  5. Insert your own custom code into the appropriate spot in the file editor. Our sample list will be added before the widgets as shown below. Click the Update File button and the new code will be saved to the sidebar.php file. Below is a screenshot of the blog with the nested list in the sidebar. Note that your particular format (font, indentation,e tc) may vary according to your theme.
    add new code to sidebar

    Before After
    before nested list add


Was this article helpful? Let us know!