WP-PostRatings 1.11

There is a bug in WP-PostRatings 1.11 together with WordPress 2.1.x which will not remember any ratings if you have rated the post. The bug seems to go away if you are using WordPress 2.2. I presumed there is some changes to the add_post_meta() and update_post_meta() in WP 2.2. I have since fixed the bug and now it works perfectly on WP 2.1.x and WP 2.2.

If you guys have previously downloaded WP-PostRatings 1.11, kindly re-download it again. Sorry for any inconvenience caused.

WP-PostRatings 1.11
» Readme/Changelog
» Demo
» Download Mirror #1
» Download Mirror #2
» Support Forum

1 Star2 Stars3 Stars4 Stars5 Stars (522 votes, average: 3.92 out of 5)

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().

1 Star2 Stars3 Stars4 Stars5 Stars (133 votes, average: 3.92 out of 5)

WordPress 3.1 Beta 1

WordPress 3.1 Beta 1 has been released!

Snippet:

If all goes well, we hope to release WordPress 3.1 to the world at large by the end of the year, though that is (as always) subject to change/dependent on how the beta period goes. The more help we get with testing and fixing bugs, the sooner we will be able to release the final version.

Some of the new features to check out include:

There are also some known issues: things that aren’t *quite* finished, but that weren’t worth holding up the beta release. They will be fixed before 3.1 is released for general use. Note that as things get fixed, the beta release will update nightly. What you should know:

  • Fatal error: Call to a member function is_page() on a non-object in /wp-includes/query.php. is_page() may be any conditional tag. This issue occurs when a theme or plugin is doing something wrong. Some code is checking the value of a conditional tag before we actually set up the Query, which means they don’t work yet. In 3.0, they silently failed and always returned false. In 3.1 Beta 1, this is throwing a fatal error. This will be handled in the final release, so use this opportunity to fix your plugins. (#14729)
  • All known issues slated for fixing before launch are listed in Trac. Please check this list to see if a bug is already on the list before reporting it.

Download: WordPress 3.1 Beta 1

1 Star2 Stars3 Stars4 Stars5 Stars (121 votes, average: 3.92 out of 5)

WordPress 4.1 Released

WordPress 4.1 has been released.

New features

  • New default theme: Twenty Fifteen
  • Distraction-free writing mode
  • Choose a language – Right now, WordPress 4.1 is already translated into over forty languages, with more always in progress. You can switch to any translation on the General Settings screen
  • Log out everywhere – If you’ve ever worried you forgot to sign out from a shared computer, you can now go to your profile and log out everywhere
  • Vine embeds – Embedding videos from Vine is as simple as pasting a URL onto its own line in a post. See the full list of supported embeds
  • Plugin recommendations – The plugin installer suggests plugins for you to try. Recommendations are based on the plugins you and other users have installed
  • Complex Queries – Metadata, date, and term queries now support advanced conditional logic, like nested clauses and multiple operators — A AND ( B OR C )
  • Customizer API – The customizer now supports conditionally showing panels and sections based on the page being previewed
  • <title> tags in themes – add_theme_support( 'title-tag' ) tells WordPress to handle the complexities of document titles

For more detailed information, checkout the changelog!

Download: WordPress 4.1

1 Star2 Stars3 Stars4 Stars5 Stars (109 votes, average: 3.92 out of 5)

WordPress 4.2 Released

WordPress 4.2 has been released!

[wpvideo e9kH4FzP]

What’s New?

  • New and improved Press This
  • New characters out-of-the-box, including emoji, native Chinese, Japanese, and Korean characters, musical and mathematical symbols, and hieroglyphs.
  • Switch themes in the Customizer
  • More embeds (Tumblr.com and Kickstarter)
  • Streamlined plugin updates
  • utf8mb4 support
  • JavaScript accessibility with wp.a11y.speak()
  • Shared term splitting
  • Complex query ordering for WP_Query, WP_Comment_Query, and WP_User_Query

Download: WordPress 4.2

1 Star2 Stars3 Stars4 Stars5 Stars (95 votes, average: 3.92 out of 5)