WordPress.org

Ready to get started?Download WordPress

Forums

HTML <a> outputed the_category() is unaccessible for CSS (2 posts)

  1. Libor Jelinek
    Member
    Posted 5 years ago #

    Dear developers,
    template tag the_category() has currently parameters separator string and how to display links that reside in child (sub) categories. (the_category('separator', 'parents' )).

    E.g. the_category(' ') output HTML like this:
    <a href="http://url/to/category" title="Display all posts in category 'Category name'" rel="category tag">Category name</a>

    But is unaccessible for CSS selectors under IE 6 because it hasn't support for attribute selectors (a[rel~=category] { something; })...

    Will be very nice for next release to add two parameters called htmlClass and htmlId for passing desired CSS class or CSS id respectively.

    E.g. the_category(' ', 'single', '<strong>myWpCategoriesCustimizedLinksCssClass</strong>') should output HTML like this:
    <a href="http://url/to/category" title="Display all posts in category 'Category name'" rel="category tag" class="<strong>myWpCategoriesCustimizedLinksCssClass</strong>">Category name</a>

    Now is nessessary to replace such simple the_category() call by something like this:

    foreach((get_the_category()) as $category) {
      echo '<a href="'.get_category_link($category->cat_ID).'" class="<strong>myWpCategoriesCustimizedLinksCssClass</strong>">'.$category->cat_name.'</a>';
    }

    WordPress is great thanks to you!
    Libor

  2. Aysseline
    Member
    Posted 5 years ago #

    is unaccessible for CSS

    false :

    <li class="catag"><?php the_tags('',' > '); ?></li> or
    <span class="catag"><?php the_tags('',' > '); ?></span>

    give you what you need.

    Simple and effective, code less (like jQuery)

Topic Closed

This topic has been closed to new replies.

About this Topic