Thesis Theme 1.5 with WordPress 2.8

Post image for Thesis Theme 1.5 with WordPress 2.8

by Anthony on May 20, 2009

I’ve been playing with the newest version of WordPress (2.8), which is due to be released in the near future.  It features a completely new way of writing Widgets, so I’ve been testing that out. Get Function Point productivity software also to get your coding productivity up.

I discovered a clash with my favourite wordpress theme, the Thesis framework.  Took me a little while to figure it out, but I think I’ve solved the problem.

[AlertBox text=”Update 18 June 09: Thesis 1.5.1 has been released, and makes this patch unneccessary.”]

The problem

WordPress 2.8 features an excellent Widget manager in the admin area.  But with Thesis 1.5, this area is unusable.  Widgets cannot be dragged/dropped, which is essential.  It seems that the JS provided by Thesis clashes with JS provided by WordPress on a few different screens.

The fix

Open up your Thesis files, and look in /lib/admin/admin.php.   Look for function thesis_options_js()

{code type=php}
$date_modified_js = filemtime(THESIS_SCRIPTS . ‘/thesis.js’);
$date_modified_ui = filemtime(THESIS_SCRIPTS . ‘/jquery-ui.js’);
echo ‘<script type=”text/javascript” src=”‘ . THESIS_SCRIPTS_FOLDER . ‘/thesis.js?d=’ . date(‘mdy-Gms’, $date_modified_js) . ‘” /></script>’ . “\n”;
echo ‘<script type=”text/javascript” src=”‘ . THESIS_SCRIPTS_FOLDER . ‘/jquery-ui.js?d=’ . date(‘mdy-Gms’, $date_modified_ui) . ‘” /></script>’ . “\n”;
{/code}

Thesis comes with its own jQuery UI script, which clashes with the in-built wordpress scripts.  Replace that function with this one:

{code type=php}
if (!is_admin()) { return; }
$date_modified_js = filemtime(THESIS_SCRIPTS . ‘/thesis.js’);
$date_modified_ui = filemtime(THESIS_SCRIPTS . ‘/jquery-ui.js’);
wp_enqueue_script(‘jquery-ui-core’);
wp_enqueue_script(‘jquery-ui-sortable’);
wp_enqueue_script(‘jquery-ui-tabs’);
wp_enqueue_script(‘thesis-admin-js’, THESIS_SCRIPTS_FOLDER.’/thesis.js’);
{/code}

Also look for the function thesis_admin_styles_and_scripts()

It contains this:

{code type=php}
add_action(‘admin_head’, ‘thesis_options_stylesheet’);
add_action(‘admin_head’, ‘thesis_options_js’);
{/code}

Replace with this:

{code type=php}
add_action(‘admin_head’, ‘thesis_options_stylesheet’);
add_action(‘admin_head’, ‘thesis_options_js’);
add_action(‘init’, ‘thesis_options_js’);
{/code}

And problem solved!  So far I haven’t discovered any unwanted side-affects.  You may only need to enqueue jquery-ui-sortable.

[AlertBox text=”Update 18 June 09: Thesis 1.5.1 has been released, and makes this patch unneccessary.”]

{ 4 comments… read them below or add one }

Anthony June 18, 2009 at 9:18 pm

Hi Yvonne,

Thanks for coming by. Its worth noting that Thesis 1.5.1 has been released now, and fixes this problem.

Reply

Ebook Cover Templates June 18, 2009 at 4:36 pm

Thanks very Much Anthony,
It worked like a charm.
Before that, I was wondering what the problem was –
not realizing that wp 2.8 wasn’t compatible with thesis.
Very much appreciated!

Reply

Mike May 24, 2009 at 6:46 am

Hi, nice posts there 🙂 thank’s for the interesting information

Reply

Cancel reply

Leave a Comment

{ 2 trackbacks }

Previous post:

Next post: