Skip to:
Content
Pages
Categories
Search
Top
Bottom

make hand coded menu dynamic

  • Avatar of admin25
    admin25
    Participant

    @admin25

    I have made a static menu and need it to be dynamic in that I need the selective menu item to have a background color.

    The problem is that the menu items are not static links but dynamic links made with

    `

  • <a href="activity/just-me/”>My Wall`

    so in my header.php I have:

    `

    • <a href="activity/just-me/”>My Wall

    • `

      and I am trying to style it with (also in header.php)

      `<?php
      if ( is_page(‘just-me’)) { $current = ‘one'; }
      elseif ( is_page(‘friends’) ) { $current = ‘one'; }
      elseif ( is_page(‘1′) ) { $current = ‘one'; }
      ?>

      # {
      background-color: yellow;
      }
      `

      Of course this does not work because the page names are not; “just-me”, “friend”, “1” these are part of the page slug names.

      is there a way to write
      `<?php
      if ( is_page(‘just-me’)) { $current = ‘one'; }
      elseif ( is_page(‘friends’) ) { $current = ‘one'; }
      elseif ( is_page(‘1′) ) { $current = ‘one'; }
      ?>`

      that inputs the slug? i.e something like:

      `<?php
      if ( is_page(slug(‘just-me’))) { $current = ‘one'; }
      elseif ( is_page(slug(‘friends’)) ) { $current = ‘one'; }
      elseif ( is_page(slug(‘1′)) ) { $current = ‘one'; }
      ?>`

      Thanks
      Tim

You must be logged in to reply to this topic.