Advertisement
  1. Code
  2. Plugins
Code

Displaying WordPress Site Data Via jQuery Charts

by
Languages:

In this tutorial we will use the jQuery Charts Plotting plugin, JQplot, to create a new WordPress plugin which can display some of your blog's traffic, popular categories, and more with some beautiful visual charts. Looking for a way to pimp out a client's dashboard (or your own!) with some useful infographics? Look no further... we'll show you how it's done right here.


Step 1 Creating Theme:

As a jQuery chart library we choose JQplot which is easy to use and open-source under GPL, MIT licenses. We will give 4 different charts in this post, but then by using our fantasy you can make more charts related to your WordPress site data. We will call our plugin Infograph. You can download and install ready plugin from download link given in this post. Now let's look structure of plugin step by step: The plugin contains 6 functions (1 for JS script enque, one for CSS, and 4 ones for charts), 4 shortcodes for charts and 2 action hooks. I hope you all know what is shortcode and action, so let's go on.

First we add 2 functions for adding JS and CSS support:


Step 2 "Popular Categories" Chart:

This chart is a pie which shows the most popular categories of your blog. You can place it to any page or post. Just put [ mycategories ] shortcode to any post:


Step 3 "Activity By Month" Chart:

This chart can display last 12 months activity in your blog. It shows how many posts you have posted last 12 monthes by month.


Step 4 "The Most Commented Posts" Chart:

Third chart is also about interesting data, it shows your the most commented posts.


Step 5 "Blog Velocity" Chart:

Our last chart for this tutorial shows velocity of your blog. It shows average number of your post count by month.

Using WordPress API's and jQuery charts you can prolongate this chart list, these 4 charts was just examples for interested developers.

That's all. Good luck.

Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.