<p>My Solution uses:<br>
1. LJ Dynamic Fields Plugin<br>
2. 1 Structure I called SiteMenu</p>

<p>What I did is:<br><br>
1. Install LJ Dynamic Fields<br>
2. Setup a MenuLinkPage Field of fieldType Dynamic DropDown
    - In the Drop Down Options is like this because am pulling links from entries and category </p>

<pre><code>
{% set menuIds = craft.entries.section('siteMenu').ids()%}
{% set menuIdsString = menuIds | join(', not ') %}

{ "value":"#","label":"Select Page"},
{%for category in craft.categories.limit(null) %}
      { "value":"{{category.id}}" , "label":"category-{{category.group}}--{{category.title}}"},
{%endfor%}
{%for entry in craft.entries.limit(null).id('and, not '~menuIdsString).order('type ASC')%}
      { "value":"{{ entry.id }}" , "label":"{{entry.type}} - {{ entry | raw }}"  
      }
      {% if not loop.last %},{% endif %}
{%endfor%}
    </code></pre>

<ol start="3">
<li>Setup a SiteMenu Structure on its layout I added MenuLink Field.</li>
<li>Then added Pages I need for my Menu by selecting from MenuLinkPage field.</li>
<li><p>Call the menu in my _layout template like this
<pre><code>
{% block menu %}</p>

<p>{% set pages = craft.entries.section('siteMenu').level('&lt;=2') %}</p>

<p></p>

<pre><code>&lt;ul&gt;
&lt;li class="mobile-close"&gt;&lt;a href="#close" class="mobile-menu-trigger"&gt;&lt;i class="fa fa-times"&gt;&lt;/i&gt; close menu&lt;/a&gt;&lt;/li&gt;
{% cache %}  
  {% nav page in pages %}

        {% set entryId = page.menuLinkPage %}

        {% if entryId &gt; 0 %}
          {% if craft.categories.id(entryId)|length %}
            &lt;li&gt;&lt;a href="{{siteUrl}}index.php/{{ craft.categories.id(entryId).first().uri }}"&gt;{{page.title}}&lt;/a&gt;
          {% else %}
            &lt;li&gt;&lt;a href="{{siteUrl}}index.php/{{ craft.entries.id(entryId).first().uri }}"&gt;{{page.title}}&lt;/a&gt;
          {% endif %}    
{% else %}
            &lt;li&gt;&lt;a href="{{siteUrl}}"&gt;{{page.title}}&lt;/a&gt;

        {% endif %}

            {% ifchildren %}
                &lt;ul class="sub-menu"&gt;
                    {% children %}
                &lt;/ul&gt;
            {% endifchildren %}
        &lt;/li&gt;
    {% endnav %}
</code></pre>

<p>{% endcache %}<br>
    

{% endblock menu %}
</pre></code>
<br>
I hope this helps</p></li>
</ol>

CC BY-SA 3.0
2014-09-20T16:01:07.167Z
Thank you for the help! I am still a bit confused as to steps 3 and 4. Would you mind elaborating on those instructions?
frshjb373
CC BY-SA 3.0
2014-09-20T21:38:15.960Z
What I meant in step:<br>3. Adding entries in SiteMenu Structure,for each page link you need to select a page you want from MenuLinkPage Dropdown. <br>4. To show menu in your layout you loop through siteMenu channel like above
Silvanus Matiku
CC BY-SA 3.0
2014-09-21T15:07:45.907Z
Maybe I'm confused because the dropdown is empty after adding dynamic dropdown with code provided.  See screenshot: [link](http://grab.by/AxJy) and [link](http://grab.by/AxJQ). Any idea what the issue is?
frshjb373
CC BY-SA 3.0
2014-09-22T00:03:54.580Z
Hi user3038693,is your code in github? send a link I can have a look.
Silvanus Matiku
CC BY-SA 3.0
2014-09-22T15:30:48.463Z
I have it cloned in bitbucket.  Do you have a username there? If so, let me know and I'll share repository with you. Or you can contact me here with your email...[link](https://mc2.wufoo.com/forms/contact-mc2-design/)
frshjb373
CC BY-SA 3.0
2014-09-25T19:49:36.383Z
Repo has been shared @SilvanusMatiku
frshjb373
CC BY-SA 3.0
2014-09-20T01:23:39.903Z
2014-09-20T01:23:39.903Z
Silvanus Matiku
<p>I need some help with coding the navigation.</p>

<p>This is the markup:</p>

<pre><code>&lt;ul&gt;
    &lt;li class="active"&gt;&lt;a href="#"&gt;home&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;about&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;services&lt;/a&gt;
        &lt;div class="drop"&gt;
            &lt;ul&gt;
                &lt;li&gt;&lt;a href="#"&gt;signs&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;printed decals&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;vehicle &amp;amp; fleet graphics&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;banners &amp;amp; posters&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;magnetics&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;vinyl graphics&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;construction and job site signs&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;business cards &amp;amp; flyers&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;sign hardware&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/div&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="#"&gt;testimonials&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;contact&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;get quote&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>And here's a sample of my entries, channels and structures: <a href="http://grab.by/Awx8" rel="nofollow">http://grab.by/Awx8</a></p>

<p>This is what I have so far, but it's not really working at all:</p>

<pre><code>{# get menu items #}
{# {% set pageItems = craft.entries.section('services').level('&lt;= 2') %} #}

{% set pageItems = craft.entries.level('&lt;= 2') %}

{# Output the sub menu #}
&lt;ul&gt;
    &lt;li&gt;&lt;a href="{{ siteUrl }}"&gt;Home&lt;/a&gt;&lt;/li&gt;

    {% nav page in pageItems %}
        &lt;li&gt;
            &lt;a href="{{ page.navigationUrlOverride ? page.navigationUrlOverride : page.url }}"&gt;
                {% if page.navigationTitle %}
                    {{ page.navigationTitle|nl2br }}
                {% else %}
                    {{ page.title }}
                {% endif %}
            &lt;/a&gt;

            {% ifchildren %}
                &lt;div class="drop"&gt;
                    &lt;ul&gt;
                        {% children %}
                    &lt;/ul&gt;
                &lt;/div&gt;
            {% endifchildren %}
        &lt;/li&gt;
    {% endnav %}
&lt;/ul&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="#"&gt;testimonials&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;contact&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;get quote&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>Any help is much appreciated.</p>

<entries><structure><navigation><drop-down>
Outputting Navigation
# Outputting Navigation

(Asked by: username_0 on 2014-09-19)

I need some help with coding the navigation.
This is the markup:

    home
    about
    services
        
            
                signs
                printed decals
                vehicle & fleet graphics
                banners & posters
                magnetics
                vinyl graphics
                construction and job site signs
                business cards & flyers
                sign hardware
            
        
    


    testimonials
    contact
    get quote


And here's a sample of my entries, channels and structures: http://grab.by/Awx8
This is what I have so far, but it's not really working at all:
{# get menu items #}
{# {% set pageItems = craft.entries.section('services').level('<= 2') %} #}

{% set pageItems = craft.entries.level('<= 2') %}

{# Output the sub menu #}

    Home

    {% nav page in pageItems %}
        
            
                {% if page.navigationTitle %}
                    {{ page.navigationTitle|nl2br }}
                {% else %}
                    {{ page.title }}
                {% endif %}
            

            {% ifchildren %}
                
                    
                        {% children %}
                    
                
            {% endifchildren %}
        
    {% endnav %}


    testimonials
    contact
    get quote


Any help is much appreciated.

**Tags:** entries, structure, navigation, drop-down


---

## 1 answers

### Answer by username_1 on 2014-09-20. Score: 1

My Solution uses:
1. LJ Dynamic Fields Plugin
2. 1 Structure I called SiteMenu
What I did is:
1. Install LJ Dynamic Fields
2. Setup a MenuLinkPage Field of fieldType Dynamic DropDown
    - In the Drop Down Options is like this because am pulling links from entries and category 

{% set menuIds = craft.entries.section('siteMenu').ids()%}
{% set menuIdsString = menuIds | join(', not ') %}

{ "value":"#","label":"Select Page"},
{%for category in craft.categories.limit(null) %}
      { "value":"{{category.id}}" , "label":"category-{{category.group}}--{{category.title}}"},
{%endfor%}
{%for entry in craft.entries.limit(null).id('and, not '~menuIdsString).order('type ASC')%}
      { "value":"{{ entry.id }}" , "label":"{{entry.type}} - {{ entry | raw }}"  
      }
      {% if not loop.last %},{% endif %}
{%endfor%}
    

Setup a SiteMenu Structure on its layout I added MenuLink Field.
Then added Pages I need for my Menu by selecting from MenuLinkPage field.
Call the menu in my _layout template like this

{% block menu %}
{% set pages = craft.entries.section('siteMenu').level('<=2') %}


 close menu
{% cache %}  
  {% nav page in pages %}

        {% set entryId = page.menuLinkPage %}

        {% if entryId > 0 %}
          {% if craft.categories.id(entryId)|length %}
            {{page.title}}
          {% else %}
            {{page.title}}
          {% endif %}    
{% else %}
            {{page.title}}

        {% endif %}

            {% ifchildren %}
                
                    {% children %}
                
            {% endifchildren %}
        
    {% endnav %}

{% endcache %}
    

{% endblock menu %}


I hope this helps

> **Comments:**
> **username_0**: Thank you for the help! I am still a bit confused as to steps 3 and 4. Would you mind elaborating on those instructions?  
> **username_1**: What I meant in step:<br>3. Adding entries in SiteMenu Structure,for each page link you need to select a page you want from MenuLinkPage Dropdown. <br>4. To show menu in your layout you loop through siteMenu channel like above  
> **username_0**: Maybe I'm confused because the dropdown is empty after adding dynamic dropdown with code provided.  See screenshot: [link](http://grab.by/AxJy) and [link](http://grab.by/AxJQ). Any idea what the issue is?  
> **username_1**: Hi user3038693,is your code in github? send a link I can have a look.  
> **username_0**: I have it cloned in bitbucket.  Do you have a username there? If so, let me know and I'll share repository with you. Or you can contact me here with your email...[link](https://mc2.wufoo.com/forms/contact-mc2-design/)  
> **username_0**: Repo has been shared @SilvanusMatiku  

---

