• Hello!

    I seemed to have lost my check mark that would appear on highlighted tags in the last update.

    Any idea what might have happened?

    Here’s the filter I was using:

    /*
    * Highlight clicked tag in tag cloud
    */

    add_filter ( ‘wp_tag_cloud’, ‘tag_cloud_current_tag_highlight’ );
    function tag_cloud_current_tag_highlight( $return ) {
    $post_tags = array();
    if(is_single()) {
    global $post;
    $post_tags = get_the_terms($post->ID,’post_tag’);
    }
    if(is_tag()) {
    $tags = explode( ‘+’, get_query_var(‘tag’) );
    foreach( $tags as $tag ) { $post_tags[] = get_term_by(‘slug’,$tag,’post_tag’); }
    }
    if( $post_tags ) {
    foreach ($post_tags as $pt) {
    $tag = $pt->term_id;
    if(preg_match(“#-link-” . $tag . “‘ #”, $return)) {
    $return = str_replace(“link-” . $tag . “‘ “, “link-” . $tag . ” current-tag’ “, $return);
    }
    }
    }
    return $return;
    }

    Along with the following CSS:

    .current-tag:after {
    content: “”;
    display: inline-block;
    background: url(“https://thenourishedcook.com/wp-content/uploads/2014/11/Checkmark.png”) no-repeat top right;
    width: 22px;
    height: 20px;
    padding-left: 5px;
    }

    Thanks in advance for your help!
    Sharon
    thenourishedcook.com

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, @sharongraylac. Try making the following two changes.

    First, change this line:

    if(preg_match("#-link-" . $tag . "' #", $return)) {

    to this:

    if(preg_match("#-link-" . $tag . "#", $return)) {

    Then, change this line:

    $return = str_replace("link-" . $tag . "' ", "link-" . $tag . " current-tag' ", $return);

    to this:

    $return = str_replace("link-" . $tag . " ", "link-" . $tag . " current-tag ", $return);

    and then see if that corrects the problem for you.

    (The reason for needing to make those changes involves Changeset 35984: the extra tag-link-position-x class now included in the links has to also be taken into consideration.)

    Thread Starter sharongraylac

    (@sharongraylac)

    It worked!!!! ??

    Thank you SOOOOO much, girlieworks!!!!

    I LOVE this community.

    Yay @sharongraylac, I’m glad it worked for you! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Lost tag cloud customization in last update’ is closed to new replies.