WordPress.org

Ready to get started?Download WordPress

Forums

HELP! Alternate Look of Horizontally Listed Categories (2 posts)

  1. webmissy
    Member
    Posted 4 years ago #

    Hi all--

    I am trying to make a horizontal menu from WP categories -- however, I am running into a bit of trouble when it comes to styling them.

    Ideally, I'd like the categories to alternate colors (odd is one color, even is another). The closest example I can find to what I want to do is something like that of the Arthemia theme: http://demo.colorlabsproject.com/arthemia/.

    What is a way to do this so that the menu will be able to stay at the top of the page & still have pages show? (I've tried dissecting the Arthemia theme, but I get an error when I place the middle menu on page.php, for instance.)

    Is there a way you can edit the

  2. tag perhaps of the wp_ list_categories function? I can't seem to find an answer online!

    Thanks in advance!

  • stvwlf
    Member
    Posted 4 years ago #

    Hi

    Just a few lines of jQuery code will do the alternate striping for you. It will automatically add the classes of odd and even, which you then style in the CSS.

    Here is an article about how to do this
    http://www.haleystar.com/blog/easy-zebra-lists-and-tables-css-jquery
    What you do to load jquery in wp is add this line of code
    <?php wp_enqueue_script('jquery'); ?>
    before the
    <?php wp_head(); ?> line in your theme's header.php file

    The other jquery code discussed in the article gets added after
    <?php wp_head(); ?>

    You do not need to load the jquery library, which the article will discuss, as the enqueue statement does that for you. The article discusses striping a vertical list, but its exactly what you want to do except you are displaying the list horizontally.
    Also, in WordPress replace all occurences of the dollar sign $ in the script with the word jQuery capitalized exactly like that

    wp_list_categories creates the UL / LI HTML structure the article discusses

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags