My 17 plugins download count has surpass the 1 million mark. As of 2.44pm (GMT+8), it has a total download of 1,001,369 making up 4.5% downloads of the grand total downloads of 22,152,788 on WordPress.org.
WordPress PowerPoint Template
I googled and could not find any WordPress PowerPoint Template for me to use for my WordPress presentation entitled, Using WordPress as a blogging tool, which will take place during Blogout’09 on the 7th March 2009.
So I thought, I must as well create it and share with those who needed a WordPress theme PowerPoint Template for a WordPress related presentation. Logos and colors are referenced off WordPress Logos and Graphics.
WordPress PowerPoint Template (90.4 KiB, 9,286 hits)
WordPress 2.7.1
WordPress 2.7.1 has been release. There are a total of 68 fixed tickets and lots of changed files.
Download: WordPress 2.7.1
WordPress Plugin Developer Day
Matt has announced today (28th January 2009, 29th in my timezone) to be WordPress Plugin Developer Day.
WordPress by itself is very simple – what makes it compelling for most of its users is the wide array of plugins (and themes) available for WP. The average WordPress blog has about 5 plugins installed! Today we just passed 4,000 plugins available in our plugin directory. (Which is also embedded into everyone’s WordPress 2.7 or above.)
I declare January 28th our official “Thank a Plugin Developer” day. To celebrate take a look at the plugins you use and love, visit the author’s site, find their contact form, and drop them a note thanking them. (Or Paypal!) Look for the links in the plugin directory to “author homepage” and also to donate directly if they’ve specified a Paypal address.
Thank you to everyone who has ever written a plugin for WordPress, and here’s to the next four thousand.
🙂
Donations I received today:
- John Kolbert – http://www.johnkolbert.com/
- WP Candy Team – http://wpcandy.com/
Loading JavaScript In Footer In WordPress 2.8
As you may all know by now, WordPress 2.8 will have some optimization done on JavaScript as well as CSS. That includes concatenating the scripts/styles, minifying it instead of packing as well as gzipping. I have been paying much attention to the development of WordPress 2.8 especially when it comes to JavaScripts. I have filed 2 suggestion tickets in WordPress Trac, Ticket #8884 and Ticket #8859 which should be able to help plugin authors load their JavaScript easily in the footer of WordPress.
This post shall be a tutorial post and I will demonstrate how to load JavaScript in the theme’s footer in WordPress 2.8 Nightly using my WP-Polls as an example.
### Function: Enqueue Polls JavaScripts/CSS
add_action('wp_enqueue_scripts', 'poll_scripts');
function poll_scripts() {
wp_enqueue_style('wp-polls', plugins_url('wp-polls/polls-css.css'), false, '2.50', 'all');
wp_enqueue_script('wp-polls', plugins_url('wp-polls/polls-js.js'), array('jquery'), '2.50', true);
wp_localize_script('wp-polls', 'pollsL10n', array(
'ajax_url' => plugins_url('wp-polls/wp-polls.php'),
'text_wait' => __('Your last request is still being processed. Please wait a while ...', 'wp-polls'),
));
}
The poll_scripts() function will hook onto the wp_enqueue_scripts function. This will allow you to enqueue JavaScripts as well as CSS Styles for your plugin.
As the name goes, wp_enqueue_style() will queue and then print out your plugin’s CSS link.
wp_enqueue_script() will queue and then print out the JavaScript link. The difference between WP2.7’s wp_enqueue_script() and WP2.8’s wp_enqueue_script() is the addition of the last argument which is whether to load the JavaScript in the footer. If set to true, it will load it in the footer, PROVIDED that your theme has the following code:
in the theme footer (refer to the default theme footer.php if unsure). Many themes especially self-created ones has failed to include wp_head() in the header.php as well as wp_footer() in the footer.php. The default value of the last argument is false, which means it will load it in the header by default.
wp_localize_script() will allow your to translate strings within your plugin JavaScript. To access the translated variable, you can use “pollsL10n.text_wait” (without the quotes).
This new hook:
do_action('admin_enqueue_scripts', $hook_suffix);
will allow you to enqueue your plugin JavaScript or CSS within the WP-Admin area easily rather than calling many times add_action() repeatedly depending on how many pages your plugin has in the WP-Admin area.
The sample code from WP-Polls to print JavaScripts as well as CSS in the WP-Admin area are as follows:
### Function: Enqueue Polls Stylesheets/JavaScripts In WP-Admin
add_action('admin_enqueue_scripts', 'poll_scripts_admin');
function poll_scripts_admin($hook_suffix) {
$poll_admin_pages = array('wp-polls/polls-manager.php', 'wp-polls/polls-add.php', 'wp-polls/polls-options.php', 'wp-polls/polls-templates.php', 'wp-polls/polls-uninstall.php');
if(in_array($hook_suffix, $poll_admin_pages)) {
wp_enqueue_style('wp-polls-admin', plugins_url('wp-polls/polls-admin-css.css'), false, '2.50', 'all');
wp_enqueue_script('wp-polls-admin', plugins_url('wp-polls/polls-admin-js.js'), array('jquery'), '2.50', true);
wp_localize_script('wp-polls-admin', 'pollsAdminL10n', array(
'admin_ajax_url' => plugins_url('wp-polls/polls-admin-ajax.php'),
'text_delete_all_logs' => __('Delete All Logs', 'wp-polls'),
));
}
}
Firstly, I assigned all the pages of WP-Polls that has an admin page to an array. Next I check whether the current page is within the array. If it is in the array, it means that the user is accessing WP-Polls admin area and thus, I will proceed on to enqueue the JavaScript or CSS needed in the WP-Polls admin area.
Note 1: When you use wp_enqueue_script(), it will automatically register the script and then print it out, whereas if you use wp_register_script(), you will have to manually print it out by calling wp_print_scripts().