Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Put this code in your theme functions.php
- function wpb_tags() {
- $wpbtags = get_tags();
- foreach ($wpbtags as $tag) {
- $string .= '<span class="tagbox"><a class="taglink" href="'. get_tag_link($tag->term_id) .'">'. $tag->name . '</a><span class="tagcount">'. $tag->count .'</span></span>' . "\n" ;
- }
- return $string;
- }
- add_shortcode('wptags' , 'wpb_tags' );
- // How to use - [wptags]
- //little bit css to your style.css
- .tagbox {
- background-color:#eee;
- border: 1px solid #ccc;
- margin:0px 10px 10px 0px;
- line-height: 200%;
- padding:2px 0 2px 2px;
- }
- .taglink {
- padding:2px;
- }
- .tagbox a, .tagbox a:visited, .tagbox a:active {
- text-decoration:none;
- }
- .tagcount {
- background-color:green;
- color:white;
- position: relative;
- padding:2px;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement