6367 readers
( example screenshot )PHP
add_action( 'init', 'jquery_register' );
function jquery_register() {
if ( !is_admin() ) {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', ( 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' ), false, null, true );
wp_enqueue_script( 'jquery' );
}
}
add_action('wp_head','wps_highlight_hash');
function wps_highlight_hash(){
echo '
$(document).ready(function() {
/* HIGHLIGHT
-
4766 readersWordPress can easily manage scripts and style sheets, a prerequisite is the use of the opportunities around wp_enqueue_script() and wp_enqueue_style(). A small function can help and returns the built-in scripts and styles.
Some Background
Scripts and style sheets can be introduced into WordPress in different ways, which applies to the backend and frontend. The classical methods of
-
9144 readersAdd Google+ button to your posts automatically
Google+ is a new “social” service offered by Internet giant Google. If you want to let your visitor “plus” your post, why not adding a Google+ button to all of your entries automatically?
Simply paste the code below into your functions.php file. Once you saved the file, the Google+
-
4641 readersStarting in WordPress 2.1 (if I remember correctly), the awesome folks at Automattic gave us the even awesomer function of wp_enqueue_script. Before that, it was every plugin or theme author for himself. If you wanted to add in a script, it was hard-coded in. As you might imagine, this presented a ton of problems. Scripts
1549 readersThere will be a new function in the coming 3.0 version, which will create a shortlink to a post. At default it will be in the header of your frontend. A shortlink would always be with ?p= syntax and the ID of the post. <link rel='shortlink' href='http://bueltge.de/?p=717' /> To use the shortlink in your theme,
-
3339 readersWhen adding scripts to WordPress, you will inevitably run into a small, but painful, issue of localization. Localizing a plugin or theme is relatively straightforward, but JavaScript presents its own difficulties since we can’t easily call the PHP functions necessary (which is one reason authors embed JavaScript in PHP files). Since embedding JavaScript in PHP
-
3792 readersGravatar recently launched Hovercards, a new feature that servers as a nifty bridge between your Gravatar and your Gravatar Profile. Hovercards have already been enabled throughout WordPress.com and WordPress.org, and there is an official plugin in the works, but what if you can’t wait for the official plugin to add Hovercards to your WordPress blog?
3731 readersI’m a HUGE fan of being able to link up a CSS file on a per-page basis. I just find it extremely common that a page needs CSS styling unique to it, and I hate litering a sites main stylesheet with customizations that only one particular page needs. We’ve talked about this before, and even
8426 readersDisplay a snapshot of any website
Want to be able to take a snapshot of any website, and display it on your blog? This cool shortcode allows you to do so. Just paste the following code into your functions.php file:
function wpr_snap($atts, $content = null) {
extract(shortcode_atts(array(
"snap" => 'http://s.wordpress.com/mshots/v1/',
"url" =>
6293 readers
PHP
add_filter('the_content', 'google_plusone');
function google_plusone($content) {
$content = $content.'';
return $content;
}
add_action ('wp_enqueue_scripts','google_plusone_script');
function google_plusone_script() {
wp_enqueue_script('google-plusone', 'https://apis.google.com/js/plusone.js', array(), null);
}
Visit wpsnipp.com for details on how to setup this WordPress snippet. Share this post. Facebook | StumbleUpon | Delicious | Tweet It | Digg This | DesignBump-It | DesignPoke-it