[wp-trac] [WordPress Trac] #19503: Add major core version global for easier plugin/theme development
WordPress Trac
wp-trac at lists.automattic.com
Sun Dec 11 00:47:38 UTC 2011
#19503: Add major core version global for easier plugin/theme development
------------------------------------+------------------------------
Reporter: johnjamesjacoby | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch dev-feedback |
------------------------------------+------------------------------
Comment (by dd32):
> You can also use floatval($wp_version) to get the major version number.
That's what we do in Core, but you have to be aware that some non-en
locale's don't use . as the decimal seperator, and so you end up with 3,2
See trunk's code here: [http://core.trac.wordpress.org/browser/trunk/wp-
admin/admin-header.php#L85 admin-header.php#L85]
Ideally though, you shouldn't need to do version compares if at all
possible.. Instead you should be feature testing, For example: [19580]
{{{
+ $screen = get_current_screen();
+
+ if ( method_exists( $screen, 'add_help_tab' ) ) {
+ // WordPress 3.3
+ $screen->add_help_tab( array(
+ 'title' => __( 'Overview', 'twentyeleven' ),
+ 'id' => 'theme-options-help',
+ 'content' => $help,
+ )
+ );
+
+ $screen->set_help_sidebar( $sidebar );
+ } else {
+ // WordPress 3.2
+ add_contextual_help( $screen, $help . $sidebar );
+ }
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19503#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list