WordPress Themes, Plugins, Tutorials, Tips And More...

Tag: Code Snippet Page 2 of 5

Snippets Collection Part – 5

Programming-1

How To Display A Thumbnail Of Any Website

Using the following snippet, you will be able to display a thumbnail of any website.

Once done, you can use the snap shortcode:

Snippet Source/Credit: Greekeries.fr

How To Automatically notify your members on new posts

Using the following snippet, you will be able to automatically notify your members on new posts.

Snippet Source/Credit: WordPress Codex

How To Display A Thumbnail From A YouTube Video Using A shortcode

Using the following snippet, you will be able to display a thumbnail from a YouTube video using a shortcode.

Snippet Source/Credit: Gunay

How To Automatically Add Post Name To The Body Class

Add the following snippet in your theme’s functions.php file, you will be able to automatically add post name to the body class.

Snippet source/Credit: WPProgrammer.com

How To Add An Extra Contact Methods To User Profiles

Using the following snippet, you will be able to add an extra contact methods to user profiles.

Snippet Source/Credit: TutsPlus

How To Automatically Prefetch Next Pages On Your WordPress Blog

Using the following snippet will let you automatically prefetch next pages on your WordPress blog. All you have to do is to simply paste the snippet in your theme’s header.php file and you are done.

Snippet Source/Credit: Bernd

Snippets Collection Part – 4

Programming-7

How To Limit Posts Per Page On Search

Using the following snippet, you will be able to limit posts per page on search.

Snippet Source/Credit: WordPress.org

How To Display The Number Of Results In WordPress Search

Using the following snippet, you will be able to display the number of results in WordPress search.

Now, simply replace it with to:

Snippet Source/Credit: ProBlogDesign

How To Log-in A WordPress User Programmatically

Using the following snippet, you will be able to log-in a WordPress user programmatically.

Once done, now to log-in a user, just simply do the following:

Snippet Source/Credit: emoticode

How To Create A Pinterest ‘Pin It’ Button For Your Blog

Using the following snippet, you will be able to create a Pinterest “Pin It” button for your blog.

Once done, open your footer.php file and add the Pinterest JavaScript code:

Snippet source/Credit: MarketingTechBlog

Snippets Collection Part – 3

Programming-3

How To Change WordPress Login Logo Title Attribute

Using the following snippet, you will be able to change WordPress login logo title attribute.

Snippet Source/Credit: Dave Clements

How To Load All Posts From The Current Week

Using the following snippet, you will be able to load all posts from the current week.

Source Snippet/Code: Christian Brückner

How To Add A Custom Message To The Editor Pane

Using the following snippet, you will be able to add a custom message to the editor pane.

Snippet Source/Credit: WP Tuts

How To Remove Widgets From WordPress Dashboard

Using the following snippet, you will be able to remove widgets from WordPress dashboard.

Snippet Source/Credit: WP Guru

How To Delete WordPress Post Revisions Using Your Functions.php File

Using the following snippet, you will be able to delete WordPress post revision using your functions.php file.

Snippet Source/Credit: Hardeep Asrani

How To Add A Link To Your Post Using RSS Feed

Using the following snippet, you will be able to add a link to your post using RSS feed.

Snippet Source/Credit: Yoast

Snippets Collection Part – 2

Programming-2

How To Add A Google+ Button To Your Posts

Using the following snippet, you will be able to add a Google+ button to your posts.

Snippet Source/Credit: SpyResStudios

How To Add Gravatars For The Post Author

Using the following snippet, you will be able to add Gravatars for the post author.

Snippet Source/Credit: emoticode

How To Change Author URL Base

Using the following snippet, you will be able to change author URL base.

Snippet Source/Credit: Kevin Chard

How To Redirect To A Custom Page After Registration

Using the following snippet, you will be able to redirect to a custom page after registration.

Snippet Source/Credit: TheDeadMedic

Snippets Collection Part – 1

Programming-4

How To Completely Shut Down WordPress Search

Using the following snippet, you will be able to shut down WordPress search completely.

Snippet Source/Credit: WPEngineer

How To Enlight Searched Text In Search Results

Using the following snippet, you will be able to enlight searched text in search results.

And now just before the line you modified, add this code of lines:

Once done, now open style.css and append the following line to it:

Snippet Source/Credit: Yoast

How To Automatically Add Facebook Open Graph To Your Posts

Adding the following snippet in your WordPress theme’s functions file, you will be automatically able to add Facebook open graph to your posts.

Once done, now open your header.php and replace the <html> tag with:

Snippet Source/Credit: WP Tutsplus

How To Redirect To First Post If Only One Post Is Found

Using the following snippet, you will be able to redirect to first post if only one post is found.

Snippet Source/Credit: Paulund.co.uk

How To Make Your WordPress Website SEO Friendly Without A Plugin

Using the following snippet, you will be able to make your WordPress website SEO friendly without a plugin.

Once done, simply replace the $default_keywords in line 3 with your own keywords and add the following line of code into your theme’s header.php file.

Snippet Source/Credit: Jeff Starr

Best Of WordPress Code Snippet Part – 5

Programming-2

How To Load All Posts From The Current Week

Using the following snippet and you will be able to load posts from the current week.

Source Snippet/Code: Christian Brückner

How To Add A Custom Message To The Editor Pane

Simply by copying the following snippet in your theme’s functions.php file, you will be able to add a custom message to the editor pane.

Snippet Source/Credit: WP Tuts

How To Remove Widgets From WordPress Dashboard

Simply paste the following snippet in your theme’s functions.php file and you will be able to accomplish the task.

Snippet Source/Credit: WP Guru

How To Delete WordPress Post Revisions Using Your Functions.php File

Simply paste the following snippet in your functions.php file and you are done.

Snippet Source/Credit: Hardeep Asrani

How To Limit Posts Per Page On Search

Just paste the following snippet in your functions.php file and replace the number on line 3 by the desired number of posts you wish to display and you are done.

Snippet Source/Credit: WordPress.org

Best Of WordPress Code Snippet Part – 4

Programming-3

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.

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.

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.

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.

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.

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.

Snippet Source/Credit: Dave Clements

Best Of WordPress Code Snippet Part – 3

Programming-7

Adding Custom Text To Your Website’s Login Page

Simply paste the following snippet in your theme’s functions.php file while to customize the message, you can do on line 3.

Snippet Source/Credit: WP Snippy

How To Show A Short Intro Of The Author Bio

In order to achieve this, all you have to do is to simply copy and paste the following snippet into your theme’s functions.php file.

Remember a thing more, once added the above snippet, add the following line of code at the place where you want to display a short introduction of the author byline:

Snippet Source/Credit: Tim Marcher

Changing Contents Of A Dashboard Tab

Just, simply paste the snippet below into your functions.php file.

Snippet Source/Credit: WP Tuts

How To Add A Breadcrumb To Your Blog

Simply paste the following code to your functions.php file and you are done.

Once done, call the following function by opening header.php:

Snippet Source/Credit: emoticode

Setting The Default Image Size In WordPress Galleries

Simply using the following snippet which you have to paste in your theme’s functions.php file with which you can set the default image size in your built-in WordPress galleries.

Snippet Source/Credit: emoticode

Adding Paragraph Tags Automatically In Your WordPress Blog

Using the wpautop() function, WordPress itself add paragraph tag to the content as well as the excerpt BUT if you wish to make an addition to this by adding paragraph tags to any text, simply add the following snippet and you are done.

Snippet Source/Credit: Daniel Pataki

Best Of WordPress Code Snippet Part – 2

Programming-6

How To Protect Your Blog Against Image Hotlinking

Using the following snippet you will be able to protect your blog against image hotlinking.

Snippet Source/Credit: WPRecipies

How To Search Within Post Type Only

If you want to force the search engine to search only within a specific post type, then all you have to do is simply copy and paste the following code into your theme’s functions.php file. Remember to change the post type name on line 4 and you are done.

Snippet Source/Credit: Hongkiat

How To Automatically Add Twitter And Facebook Buttons To Your Posts

Adding the following snippet to your theme’s functions.php file, you will be able to add Twitter and Facebook buttons to your posts. It will display both Facebook and Twitter buttons at the bottom of this post.

Snippet Source/Credit: WPRecipes

How To Remove Login Shake Effect At The Time When Error Occurs

Using the following snippet will let you remove the login shake effect when error occurs. Simply paste the following code in your theme’s functions.php file and you are done.

Snippet Source/Credit: WordPress Support Forum

How To Add .pdf Support To Your WordPress Blog Media Manager

Copy and paste the following snippet into your theme’s functions.php file and you are done.

Snippet Source/Credit: WP Tuts

Making Translatable JavaScript Strings On Your WordPress Theme

With the help of snippet below, you will be able to make translatable JavaScript strings on your WordPress theme. Make sure you paste the following code into your function.php file.

Snippet Source/Credit: WPTheming.com

 

 

Best Of WordPress Code Snippet Part – 1

Programming-4

How To Completely Shut Down WordPress Search

Copy and paste the following snippet in your theme’s functions.php file and you are done.

Snippet Source/Credit: WPEngineer

How To Enlight Searched Text In Search Results

You do wish to Enlight searched text in your blog’s search results. To do so, simply open your theme’s search.php file and then find the the_title() function and replace it with:

And now just before the line you modified, add this code of lines:

Once done, now open style.css and append the following line to it:

Snippet Source/Credit: Yoast

Context Menus With HTML5

The following snippet below will give you an idea that what Context Menus with HTML5 actually is.

Snippet Source/Credit: Speckyboy

How To Make Your WordPress Website SEO Friendly Without A Plugin

This can be achieve by simply pasting the code in your theme’s functions.php file and you are done.

Snippet Source/Credit: Jeff Starr

Page 2 of 5

Powered by WordPress & Theme by Anders Norén