Popular Posts Bar WordPress Widget
Customize
Below are shown some tips to customize your Popular Posts Bar WordPress Widget.
Time Lapses
By default, the time lapse is -7 days, which means it will substract 7 days to the current date. In other words, if today is Tuesday, it will go back all the way to last week's Thursday and it will begin counting posts from there.
To change it, just make sure you're spelling correctly the times. Here are some examples:
-1 month
-1 week
is an alias for-7 days
-3 days
-24 hours
will show the most commented posts in the last 24 hours. Recommended for very popular blogs.
Let's say you want the most popular posts for this week, so if today is Tuesday, the Plugin will just count the comments made on Sunday, Monday and Tuesday. To achieve this, set the lapse value to last sunday
Some more examples:
this month first day 0:00
will take the comments made from this month's 1st.today
will count the comments made since the first second today.
HTML Classes
This Plugin generates an unordered list (<ul>
) with each list element (<li>
) two classes: popular_posts_bars_li
and the specified by the user in the HTML Classes field.
By default, HTML Classes is red,orange,yellow,green,blue
so the generated code will look much like:
<li class="popular_posts_bars_li red"> ... <li class="popular_posts_bars_li orange"> ... <li class="popular_posts_bars_li yellow"> ... <li class="popular_posts_bars_li green"> ... <li class="popular_posts_bars_li blue"> ...This values must be comma-separated, so they can be accessed with CSS this way:
.popular_posts_bar_li.red{ ... }If there are more posts than classes, the class
no-color
will be added to this element.
Adding Colors
In order to add new colors, first you'll have to set the number of posts in the widget control panel to something like 7. Then, the HTML Classes field to red,orange,yellow,green,blue,lightblue,lightgray
for example.
Now you'll have to create two new classes. Open popularpostbars.css
and add this lines:
.popular_posts_bar_li.lightblue{ } .popular_posts_bar_li.lightgray{ }These new classes requires a fixed width and it should be less than the previous' (in this case
blue
, which has a 80% width).
.popular_posts_bars_li.lightblue{ width: 75%; } .popular_posts_bars_li.lightgray{ width: 71%; }Open up your favorite image editor, create a 1x1 image, choose a light blue color and set its alpha to 90%, save it as png as
lightblue.png
in the same Plugin folder. Do the same with the light gray one and link it to your CSS:
.popular_posts_bars_li.lightblue{ width: 75%; background: url('lightblue.png'); } .popular_posts_bars_li.lightgray{ width: 71%; background: url('lightgray.png'); }And that's it.
Manual Embedding
You can embed manually this plugin with the following code:
<?php echo popular_posts_bars_widget('title=Your Title&lapse=-1 day&classes=red,orange,yellow,green,blue&number_posts=5&thumbnail=1&thumbnail_size=15x15'); ?>
Thank you
For purchasing and using this premuim WP Plugin. If you have any comments, feature requests or you found a bug, please contact me.