Tag: Plugins

Scheduling Functions (Cron Jobs)

Now that I’ve created a way to compile a list of how many comments I get from various countrys I wanted to run it automatically.

When I mentioned this to the head IT guy in Tees Valley Arts he suggested I use a “cron job”.

This can be done by first adding a hook for the cron job to run.

/**
 * Adds the "cron_hook" action hook.
 * This is then called by a cron job.
 */
add_action( 'cron_hook', 'location_list_shortcode' );

Then I decided to be lazy and simply use the plugin “Advanced Cron Manager”.

Once installed it can be found under “Tools”.

There sou simply add a new event.

Then you input your hook and when it should run.

Now my list of countries I get comments from is updated daily without any input from myself!

Filed under: WordPressTagged with: , , , ,

To Add A New Plugin

If you are new to this like me use a boilerplate plugin as a starting point:

https://github.com/DevinVinson/WordPress-Plugin-Boilerplate

Then simply compress it (as a Zip file) and install it onto your website.

Make sure you have some FTP software to access your websites files when you inevitably mess up and crash your website and need to delete your broken plugin to make your website function again (I recommend Cyberduck).

Filed under: WordPressTagged with:

David Scroller Plugin

The final stage in making it as easy as possible to display a number contained by a cell within a Google Spreadsheet as a scrolling number: making a plugin.

This is only Version 1.0.0 of the plugin and it is definitely not documented properly (I used both WordPress-Plugin-Boilerplate as a starting point and it includes NumScroller as part of the plugin so I need to find the correct way to comment/document/credit these to meet industry standards) but it works!

All you need to do is update your API Keys and Spreadsheet IDs:

/**
 * Stores/updates the array of Api Keys within the options database table.
 */
update_option( 'api_key_array', array(1 => "XXX_XXX"), true );
/**
 * Stores/updates the array of SpreadSheet IDs within the options database table.
 */
update_option( 'spreadsheet_id_array', array(1 => "XXX-XXX-XXX",
											 2 =>"XXX-XXX"), true );

Plop down some shortcode:

[david_scroller location="'Summary Page'!L6" api_key=1 spreadsheet_id=2 delay=1 increment=100]

And Voila:

0
Filed under: WordPressTagged with: , , , , ,