How to Display Tags in top of the Post WordPress

By | December 28, 2013

In wordpress, the single page (i.e., full post/article page) will shown the full detail about the post like date published, comments, author, title, content and some themes will show the tags at the bottom of the post. Displaying the tags at top of the post will reduce the bounce rate and make user to go the tags, which are displayed. Here is the tutorial for how to display tags in top of the post wordpress

 

Display Tags in top of the Post WordPress

Display Tags in top of the Post WordPress

 

PHP Code (post-single.php)

Add the following code into post-single.php

[code type=php]

<?php
if(get_the_tags()) {
?>
<div class=”tags-box”>
<div class=”tags-box-name”>Tagged in</div>
<?php the_tags(‘<ul><li>’, ‘</li><li>’, ‘</li></ul>’); ?>
</div>
<?php
}
?>

[/code]

 

CSS Code (style.css)

Add the following code into style.css

[code type=css]

.tags-box
{
width: 100%;
}
.tags-box-name
{
font-size: 14px;
margin: 0 2px 0 0px;
color: #3D3D3D;
text-decoration: none;
float: left;
display: block;
padding: 2px 2px 2px 0px;
}
.tags-box ul
{
list-style: none;
padding: 0;
margin: 5px 0;
}
.tags-box ul li
{
display: inline-block;
}
.tags-box ul li a
{
display: block;
padding: 1px 13px;
background: #FD6B47;
margin: 0 2px 0 0px;
color: #FFF;
text-decoration: none;
font-size: 14px;
}

[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *

freeway-complexional