How to display a counter for your Top 10 list and make it look nice
-
Hey everyone,
I just wanted to share this cool css trick that will display a numbered countdown on your top 10 posts. You can check out how it will look here. Its a few easy steps that a beginner can do.
Step 1
Edit top-10.php either directly or through your plugin admin panelOn line 262 you will replace this
$output .= $title; // Add title if post thumbnail is to be displayed after
with
$output .= "<span class='tptn_title'>" . $title . "</span>"; // Add title if post thumbnail is to be displayed after
Step 2
Next you will replace line 268
$output .= $title; // Add title when required by settings
with
$output .= "<span class='tptn_title'>" . $title . "</span>"; // Add title when required by settings
The last step is to add the CSS which is
.tptn-list{ list-style: none; counter-reset: tptn-list; margin-left: 0; } .tptn_link :before { clear:both; content: counter(tptn-list); counter-increment: tptn-list; font-weight: bold; float: left; width: 40px; background: #ffeb36; font-size: 16px; color: #000; position: absolute; top: 0 px; -moz-box-shadow: 5px 4px rgba(0,0,0,0.4); -webkit-box-shadow: 5px 4px rgba(0,0,0,0.4); text-align: center; box-shadow: 5px 4px rgba(0,0,0,0.4); margin-top: -130px; } .tptn_title{ color: #0077EE; display:block; font-size: 17px; font-weight: bold; margin-bottom: 10px; }
You can then change the design as you please. Thanks to the author ajayy for helping me with an issue i had with my counter in a previous version.
- The topic ‘How to display a counter for your Top 10 list and make it look nice’ is closed to new replies.