Forums

Removing and adding class to category links (4 posts)

  1. supergab
    Member
    Posted 8 months ago #

    Hello I'm using menus to show categories in sidebar.

    The link looks like this:

    <li id="menu-item-2261" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2261">

    but I would like it to be like this:

    <li id="menu-item-2261" class="category-photography">

    Where category-photography changes to category-articles or category-videos depending on the category link.

    I would like to put the code in functions.php. It could also be simply adding the class to the a anchor also if easier.

    Many thank for your time and help.

  2. peredur
    Member
    Posted 8 months ago #

    Could you post a link to your site so we can look at what's going on?

    Cheers

    PAE

  3. supergab
    Member
    Posted 8 months ago #

    Yes sure... http://themes.visualise.ca/visualise/

    There are two category menus in the left sidebar. The first (top) is hand coded:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I need the second one to have the li classes of the first.

  4. peredur
    Member
    Posted 8 months ago #

    I don't think I'm going to be able help, from what I can see.

    Given that you're presumably allocating the classes in your hand coding, there is nothing for WP to get hold of. Of course you could put a function in functions.php that output the sidebar code and set a variable to the value you wanted...

    But, as I say, I'm not really the person to help. Hopefully you'll get a reply from someone with a better idea than me.

    Cheers

    PAE

Reply

You must log in to post.

About this Topic