WordPress.org

Support

Support » Requests and Feedback » HTML <a> outputed the_category() is unaccessible for CSS

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

  • 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

Viewing 1 replies (of 1 total)
  • 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)

Viewing 1 replies (of 1 total)
  • The topic ‘HTML <a> outputed the_category() is unaccessible for CSS’ is closed to new replies.
Skip to toolbar