How To Load jQuery From Google CDN
WordPress by default load its own jQuery in your theme BUT using the following snippet in your theme’s functions.php file will load the library directly from Google CDN.
1 2 3 4 5 6 7 8 |
function jquery_cdn() { if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', false, '1.8.3'); wp_enqueue_script('jquery'); } } add_action('init', 'jquery_cdn'); |
Snippet Source/Credit: WP Tips
How To Paginate Your WordPress Site Like Dribbble
Simply paste the following snippet to your theme’s single.php file at the place where you want to display the dribbble-like pagination.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?php $prev = get_previous_post(); $next = get_next_post(); <div class="float--left folio"> <a href="<?php echo get_permalink($prev->ID); ?>" title="<?php echo esc_attr($prev->post_title); ?>"> <?php echo get_the_post_thumbnail($prev->ID, 'thumbnail'); ?> </a> </div> <div class="float--right folio"> <a href="<?php echo get_permalink($next->ID); ?>" title="<?php echo esc_attr($next->post_title); ?>"> <?php echo get_the_post_thumbnail($next->ID, 'thumbnail'); ?> </a> </div> |
Snippet Source/Credit: Elliott Richmond
Adding Gravatars For The Post Author
Simply paste the following snippet and you will be able to automatically add the author gravatar to each post.
1 |
<?php echo get_avatar( get_the_author_email(), '80' ); ?> |
Snippet Source/Credit: emoticode
How To Change Author URL Base
Pasting the following code in your theme’s functions.php file will change the same. Remember to replace profile on line 4 by any slug you like.
1 2 3 4 5 6 |
add_action('init', 'cng_author_base'); function cng_author_base() { global $wp_rewrite; $author_slug = 'profile'; // change slug name $wp_rewrite->author_base = $author_slug; } |
Snippet Source/Credit: Kevin Chard
How To Redirect To A Custom Page After Registration
The following snippet will let you redirect to a custom page once registration got completed. Simply copy the snippet and paste it to your theme’s functions.php file.
1 2 3 4 |
function __my_registration_redirect(){ return home_url( '/my-page' ); } add_filter( 'registration_redirect', '__my_registration_redirect' ); |
Snippet Source/Credit: TheDeadMedic
How To Change WordPress Login Logo Title Attribute
On simply pasting the following snippet into your theme’s functions.php file, you will be able to change WordPress login logo title attribute.
1 2 3 4 |
function custom_login_title() { return 'Your desired text'; } add_filter('login_headertitle', 'custom_login_title'); |
Snippet Source/Credit: Dave Clements