WordPress.org

Ready to get started?Download WordPress

Forums

comments_popup_link dynamic css (2 posts)

  1. Anonymous
    Unregistered
    Posted 5 years ago #

    Hello,

    i have this situation where the color of my "Comments" links needs to have different in some posts. I looked in the documentation and there is a parameter in the comments_popup_link which we can assign a CSS Class.

    is it possible instead of a static value e.g 'Redlink' to pass a dynamic value such as the category of the post? I know how to retrieve the category, just don't know how to pass it as a parameter.

  2. Anonymous
    Unregistered
    Posted 5 years ago #

    ok found it.
    in the loop:

    $category = get_the_category();
    $csspart = $category[0]->cat_name;

    and then:
    comments_popup_link('No Comments »', '1 Comment »', '% Comments »',$csspart);

Topic Closed

This topic has been closed to new replies.

About this Topic