Tagcloud: different color for different text size

Use a filter for the tag cloud to change the inline size declarations to CSS classes and declare the colors in your style sheet: .tag-cloud-size-8 { color: #009; font-size: .8em; } .tag-cloud-size-10 { color: #900; font-size: 1em; }

Do we have In_category like function for tags?

Here is the source of in_category function: function in_category( $category, $post = null ) { if ( empty( $category ) ) return false; return has_term( $category, ‘category’, $post ); } You see, it’s actually has_term. This is the same as has_category function. For tags, there’s no in_tag function, but you can use has_tag. It has … Read more

Split function “the_tags” in 2 columns

Use get_the_tags instead of the_tags to grab an array of tags, and array_chunk to split it. You will then need to build a loop to display the tags. $tags = get_the_tags(); if (!empty($tags)) { $tags = array_chunk($tags,ceil(count($tags)/2),true); foreach($tags as $v) { echo ‘<ul>’; foreach ($v as $tag) { echo ‘<li><a href=”‘.get_tag_link($tag->term_id).'”>’ . $tag->name . ‘</a></li>’; … Read more

show tags on “single”-template sidebar only

This will display the tags of the current post in an unordered list: <?php is_single() && the_tags( ‘<ul class=”tags”><li>’, ‘</li><li>’, ‘</li></ul>’ ) ?> http://codex.wordpress.org/Function_Reference/the_tags You’ll most likely want to drop this in sidebar.php.

Highlight current tag using get_tags()

Compare $tag->term_id with the value from get_queried_object_id(). You have to cast the former to integer, because it is provided as a string for no good reason. <ul id=”blog-tags”> <?php $tags = get_tags(); if ( $tags ) { foreach ( $tags as $tag ) { echo ‘<li>’; if ( (int) $tag->term_id === get_queried_object_id() ) echo “<b>$tag->name</b>”; … Read more

wordpress str_replace the content with tag

I can see that you are constructing an array with only one element, something like this: array( ‘green, yellow, red’ ) instead of an array with multiple elements: array( ‘green’, ‘yellow’, ‘red’ ) Try to replace these lines: $out .= $tag->name .’,’; $csv_tags .= ‘”<a href=”https://wordpress.stackexchange.com/” . $tag->slug . ‘”>’ . $tag->name . ‘</a>”‘; with … Read more

Add text to Title dynamically using tags

The code below assumes that only one tag ( ‘private’ ) has a text associated with it: function add_tag_text_to_title( $title, $id = null ) { if ( has_tag( ‘private’ ) ) { return $title . ‘ – Awesome’; } else { return $title; } } add_filter( ‘the_title’, ‘add_tag_text_to_title’, 10, 2 ); If you have more … Read more

How can i order get_the_tags?

There are always workarounds to implement the sorting: Using ksort(), Using krsort(): Add this function: function se_sort_tags_alphabetically( $tags = array() ) { if ( $tags ) { $sortData = $sorted = array(); foreach ( $tags as $i => $tag ) { if ( empty( $tag->name ) ) continue; $sortData[$tag->name] = $i; } krsort($sortData); foreach ( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)