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

Tag: WordPress Code

Best 10 Useful WordPress Snippets

A WordPress blogs, hundreds of thousands of plugins options available and what more, thousands of ways available to use these plugins but what better, if you use some good short codes which are good enough to offer you the kind of functionality that you are looking for and that in one-to-many cases, these easily available free (or premium) plugins not able to offer you. In this article, you will find ten of best WordPress snippets which not only help you but also make your job easy.


Turn Over Address Components to an Array

The snippet will help you breaking up an address into components while it also sorts a multidimensional array of location alphabetically by state.

Source: Snipplr

WordPress is_child() and is_ancestor()

To use the following snippet, simply add it in your theme’s functions.php template.

Source: CodeByte

WordPress Admin Area Functions

The snippet will allow to accomplish different WordPress functions, including after registration redirect, remove generator, admin footer, remove default dashboard items, hoook into the ‘wp_dashboard_setup’ action to register our function, remove unnecessary page/post meta boxes, screen options – remove columns and remove WP logo.

Source: Snipplr

WP – Roles and Capabilities

The snippet will let you define different roles and capabilities.

Source: Snipplr

WP Menu custom walker

The snippet will allow you to create a menu.

Source: Snipplr

WordPress – get an RSS feed, display items with a loop

The snippet will allow you to retrieve a feed into WordPress.

Source: Dangayle

Clear out jquery to prevent conflicts

The snippet will let you either link a script with a handle previously registered using the wp_register_script() function, or provide this function with all the parameters necessary to link a script.

Source: AmberWeinberg

WordPress Typography Formatting

The snippet lets dummy content to format typographic/html tags for WordPress copy.

Source: Snipplr

NO Follow WordPress Tag Cloud

The following snippet will result in no following WordPress Tag cloud. All you have to do is to add the snippet to your theme’s functions.php.

Photo Credit: thisismyurl via photopin cc

15 Useful WordPress Snippets

Developing a full fledge WordPress website and wondering on that a huge numbers of plugins you would be requiring to make it complete, don’t worry it can’t be a way all the time as there is Plan B also available which will help reduce your job: using WordPress snippets. Snippets are the short codes which you can use directly in your theme files – totally as per your requirement. Don’t worry also if in case you would be thinking that “hey, I am a WordPress beginner then what?” don’t worry on this as this short code requires very less of your technical knowledge – all important with it is the right placements of these codes in your theme files.

No Plugins Required

Page excerpt

The snippet will add excerpts for pages. All you require is to place the following code in your themes functions.php file and you are done.

Highlight author comments

Blog authors always want that their comments to look difference from that of the readers as it highlight and bring more values in reading. Using the snippet (below) will help you achieving the same. Find the list-item in the comment.php template file and add this in the class-tag.

Reset your password

This would be a biggest nightmare for you if not able to reset your password especially when you can’t use the “forgot password” function. Insert this snippet into a phpMyAdmin Sql-window.

Empty Trash Automatically

If you wish to have your WordPress trash to get empty automatically, then just add the following line of codes to the wp-config.php-file.

Image Custom Field

If you want to call the custom field for an image source, then use the following snippet.

Add Taxonomies

The snippet will allow you to create your own tag-section for your custom post types.

Remove meta generator

It would always be advisable to remove the “meta generator tag” which WordPress generates in your WordPress header. Use either of following code in your header.php template.


Disable WordPress Update

To avoid client messing up with the whole of WordPress website, just add this to disable WordPress update function by adding this into your themes functions.php template.

Add a Dashboard Widget

As soon as you login into your WordPress Dashboard, the first thing you will notice that it has been filed with number of widgets. Using this code will allow you to add your own widgets, just add this code to functions.php.

Change footer-text in WP Admin

Using the code will change the text in the bottom of the WP admin pages.

Remove meta-boxes

Using this snippet, you can remove the meta-boxes you don’t use.

Enable debug mode

Add this to your wp-config.php and you will be able to debug your WordPress blog if something went wrong.

Change Admin logo

Give your Admin panel a brand look just like whole of your blog; change the logo in the Admin panel with an image of your choice by using this snippet.

Remove Pages Columns

The code will allow you to remove a column from pages.

Change role capabilities

WordPress comes with several pre-defined role capabilities, like Author, Contributor or Administrator. In order to change these, just add the following to functions.php and you can create your own and customized it as per you like.

Photo Credit: cogdogblog via photopin cc

Powered by WordPress & Theme by Anders Norén