Sprite menu in WordPress? (5 posts)

  1. Alex
    Posted 6 years ago #

    I'm converting HTML website into wordpress, can't find how to use sprite in wordpress. Is there any way to make it, I tried lavalamp jQery, but it doesn't work very well. I'm using wp_list_pages for the menu.

  2. stvwlf
    Posted 6 years ago #

    Sprite is a CSS technique relating to background image positioning. It works the same in WordPress as anywhere else.


  3. Alex
    Posted 6 years ago #

    Thanks for the reply, but if I use wp_list_pages, I don't have li id='page1" I just have a function. Can you give me an example (very simple) how to do that in WP. Thank you.

  4. stvwlf
    Posted 6 years ago #


    wp_list_pages assigns a unique class to every page in the list:

       <li class="page_item page-item-2"><a href="/about/">About</a>
       <li class="page_item page-item-29"><a href="/contact/">Contact</a>
       <li class="page_item page-item-31"><a href="/gallery/">Gallery</a></li>

    you have the hooks you need to assign CSS sprites, using class of page-item-2, page-item-29, page-item-31. The number after page-item is the page's postID#, which never changes.

    In terms of "I don't have li id='page1" I just have a function.", that function outputs code which the browser displays. Use ViewSource or Firebug to see the output, to learn the classnames for your particular site. Then you can create the CSS from those class names. It sounds like you already know how to do that.

    If you prefer class names like 'about' and 'contact', this plugin lets you assign a custom class to any page. Then wp_list_pages will include that class name in its output.

    If anything is still not clear ask further.

  5. Alex
    Posted 6 years ago #

    THANK YOU!!!! It looks like I found what I've been looking for.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.