WordPress 3.5 Almost ready

WordPress updates aims to move the whole community forward. That is why I’m delighted to see the progress being made towards the final 3.5 release.

What’s new?

  • Appearance: changes, retina support .
  • Accessibility: Improvements to keyboard shortcuts and screen reader support.
  • Plugins:  One of my favorites is that you can browse and install plugins you’ve marked as favorites on WordPress.org.
  • Mobile: No more configuration when connecting to your WordPress blog from your mobile phone as XML-RPC is enabled by default in 3.5 .
  • Links: Remember those lins to the left? Well forget them, they’ve been removed and placed in a plugin should you still need them on your website.
  • Default Theme: A brand new default theme called “2012”.

With these changes and a few more on the way I can’t wait to hit the upgrade button.

Add/Enqueue Scripts or Styles for pages where my plugin short code is found

So you have the neat plugin and you’re really excited about getting it done, but you don’t want this wonderful plugin loading un necessary scripts and styles for every page.

This tutorial assumes that your plugin contains the short code already, if not go here.

See the code bellow:

[sourcecode language=”php”]

function my_scripts_method() {

global $post; // get the current post

if ( !empty($post) ){
// check the post content for the short code
if ( stripos($post->post_content, ‘[fbalbumsync’)!==FALSE ){
// we have found a post with the short code
wp_register_script( ‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js’);
wp_enqueue_script( ‘jquery’ );
// $url contains the path to your plugin folder
$url = plugin_dir_url( __FILE__ );
wp_enqueue_style( ‘myplugin_style’,$url.’1140.css’ );
wp_enqueue_script(‘my_plugin_js’,$url.’plugin.js’ );
}
}
}
// add scripts to wordpress front end with this hook
add_action(‘wp_enqueue_scripts’, ‘my_scripts_method’);

[/sourcecode]

I hope this helps you better your plugin.