With each major WordPress release, public changes like the new widgets administrative interface usually get all the glory. Here are some new features in WordPress 2.8 that most users won’t even know exist but you will probably care about, if you’re a WordPress developer.
- Widgets API The new widgets API lets you create widgets by extending the
WP_Widget
class. If making a multi-widget with the old system was like trying to piece together your kid’s bicycle on Christmas Eve, the new API rolls out the bike for you, tires inflated and topped with a bow. - SimplePie RSS WordPress has been using the MagpieRSS class to parse RSS feeds. Trouble is, Magpie development ground to a halt about four years ago, meaning when contemporary feeds flummoxed Magpie, flustered developers fumed, futilely. In 2.8, WordPress now reads RSS with SimplePie, an active project with a robust API.
- New Escape Functions A new set of functions consistently named and DRY-er now make your strings sparkly clean and cuddly safe.
esc_sql()
: A wrapper for the$wpdb->escape()
method.esc_url()
: Clean up an untrustworthy URL for printing.esc_url_raw()
: Clean up an untrustworthy URL for storing in the database.esc_js()
: Make text suitable for printing as a JavaScript string.esc_html()
: Convert characters that have special meaning in HTML (such as>
and<
) into their equivalent character entities.esc_attr()
: Prepare text so that it’s safe to be used in an HTML element attribute.esc_attr__()
,esc_attr_e()
, andesc_attr_x()
: Make a translatable string safe for printing as an HTML element attribute. E.g.,<a href="" title="<?php esc_attr_e('Translate me'); ?>">
esc_html__()
andesc_html_e()
: Like the last two, but for escaping HTML characters in general.
get_the_author_meta()
User data is spread out between two database tables and has been accessed—until now—by a number of methods.get_the_author_meta()
retrieves user data with one easy-to-remember function.the_post
Action Hook Called insetup_postdata()
, thethe_post
action hook is one of those things that seems so obvious and so useful that you can’t believe it hasn’t existed until now. At a crucial moment it passes the current global$post
variable by reference: during the Loop right after global variables are set but before they’re used in the template.
One Trackback
[…] 5 Things of Interest to Developers in the New WordPress 2.8 With each major WordPress release, public changes like the new widgets administrative interface usually get all the glory. Here are some new features in WordPress 2.8 that most users won’t even know exist but you will probably care about, if you’re a WordPress developer. – By Pressed Words […]