After releasing new theme: Hosting Pro, it is time to release heavily updated theme framework for other themes as well. Update was mainly focused on code optimization and design cleanup of theme administration panels, so don’t be surprised if you don’t see anything special after update.
Theme Administration Cleanup
TinyMCE Table Manipulation support
Added ‘ajaxurl’ variable for theme usage
Ajax was always easy for WordPress administration and if you’re a plugin developer, you know it’s just a few lines of code and all works out-of-the-box. Front-end is however another story. It isn’t that much difficult to include Ajax on the front-end of your site, but does get complicated if you don’t have ajax URL variable defined. This is now available by default, live example below:
1. Add HTML form to serialize
<form action="' . home_url() . '/" method="post"> <input name="ajax_input" type="text" /> <input name="ajax_submit" type="submit" /> </form>
2. Add some JavaScript:
jQuery(document).ready(function($) { $('.ajax_form').submit( function() { // ajax data function newValues() { var serializedValues = $("form.form_domain").serialize(); return serializedValues; } // variables var serializedReturn = newValues(), ajax_url = bizz_localize.ajaxurl, data = { action: 'my_ajax_response', data: serializedReturn }; // ajax response $.post(ajax_url, data, function(response) { alert("Data Loaded: " + response); }); return false; }); });
3. Add response generating PHP code:
function my_ajax_response() { $data = $_POST['data']; parse_str($data,$output); echo $output; // unserialized output die; } add_action('wp_ajax_my_ajax_response', 'my_ajax_response'); add_action('wp_ajax_nopriv_my_ajax_response', 'my_ajax_response');
SEO optimization for custom post types
Our themes are top optimized for search engines, but since introduction to custom post types, regular posts were better optimized for search engines than the rest. But not anymore. Single custom post types now have equal SEO support and you’re also able to pick custom ‘slugs‘ for them.
Updated Scripts
How to update?
Go to theme options panel and visit Updates tab. Follow the updating instructions and enjoy!
Leave a Reply