Hot answers tagged

2

On the top of my head there are two easy ways to go about this problem, first is to use the get_the_tags() function to manually loop the tags to easily insert the hashtags. $tags = get_the_tags(); if ( $tags ) { foreach ( $tags as $tag ) { ?> <a href="<?php echo get_tag_link( $tag->id ); ?>"> <?php echo '#' ...


1

Whithout knowing the value of $tags variable (you are not showing it to us), the only thing I see wrong in your code is the tag_in argumente, the correct one is tag__in (note the double _). Also, note that tag__in works with the core tag taxonomy. This taxonomy is not supported by custom post types by default, only by the standard post type.


1

Try this: $args = array( 'taxonomy' => 'post_tag', 'hide_empty' => 0 ); $tags = get_terms( $args ); $class_name = 'my-custom-class-name'; if ( ! empty( $tags ) && ! is_wp_error( $tags ) ) { shuffle( $tags ); foreach( array_slice( $tags, 0, 6 ) as $tag ) { printf( '<a class="%1$s" href="%2$s">%3$s</a>', ...



Only top voted, non community-wiki answers of a minimum length are eligible