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

Tag: WordPress Snippet Page 1 of 12

Ten ‘Must’ WordPress Snippets

Programming-4

Remove or Hide Admin Menu Links for Certain or Specific Users or Roles

The following snippet will let you remove as well as hide admin menu links for certain users or role.

Source: Snipplr

Get all media attached to a post

The following snippet will allow you to get all media attached to a post

Source: Pippinsplugins.com

Filter Category from Blog Page

The following snippet will filter category from the blog page

Source: brettwidmann.com

Custom Admin Login Logo & Alt Text

The snippet will allow you to have custom admin login logo and alt text

Source: Snipplr

Prev/Next wordpress loop links

Add the following snippet to previous/next loop links

Source: WordPress Codex

Admin Footer Modification

Source: Snipplr

Query a custom taxonomy

The following snippet will allow you to query a custom taxonomy, using the taxquery parameter

Source: Snipplr

Remove Personal Options from Profile Menu

The following snippet will allow you to remove personal options from personal menu

Source: Snipplr

Exclude Category from Feed

The following snippet will allow you to exclude category from feed

Load jQuery from CDN, fallback to local

Add the following snippet to your theme’s functions.php file

Source: Snipplr

Photo Credit: Flickr/hackNY.org

10 WordPress Snippets That You Don’t Want To Miss

Computer Programming

Update WordPress URL

Adding the following snippet to function.php file will let you update WordPress URL

Source: Snipplr

WordPress WP_ Settings

The snippet let you set some WordPress directories / paths directly to the server name.

Source: Snipplr

Access Request URI for template reuse

The following snippet will let you access request URI for template reuse

Source: Kovshenin

WordPress Widget Basic Stucture

Source: Snipplr

WordPress Child Theme

The following snippet will let you sort out the stylesheet

Source: doitwithwp.com

Custom Menus in WordPress

Source: Snipplr

SQL query to delete all media and attachments

The following snippet will delete all media in the library and remove all post attachments.

Source: WordPress.org

Simple iframe shortcode

Using the snippet will let you take iframe parameters and build an iframe through a shortcode

Source: Snipplr

Disable the WordPress file editor

The following snippet will disable the WordPress file editor

Automatically link Twitter usernames

Paste the snippet in the function.php file of your theme and it will let you automatically link Twitter usernames

Source: Snipplr

Search Posts by Custom Post Type

The snippet will let you search posts by custom post types

Source: WP-Snipp

Photo Credit: Flickr/Brad Montgomery

Ten ‘Must’ WordPress Snippets For Your Blog

Computer Program -3

Reduce spam by using .htaccess

Adding the following shortcode will let you reduce spam on your WordPress blog by using .htaccess. Simply paste the following lines into your .htaccess file but also make a note that you do make a backup of your .htaccess file before editing it.

Source: AllGuru.net

Display a thumbnail of any website

Simply paste the code below into your functions.php file.

Once done, you can use the snap shortcode:

Source: Geekeries.fr

Easily remove weird characters from your WordPress database

The shortcode will remove the weird characters from your WordPress database. All you have to do is simply run the following SQL query on your nWordPress database via the command line client or PhpMyAdmin.

Source: Jeff Starr

How to change WordPress editor font

Adding the following shortcode to your functions.php file will let you change the default WordPress editor font.

Source: DevPress

Removing the “read more” jump

Adding the shortcode into your functions.php file will remove the “read more” link from your blog which will automatically takes you to the article page.

Source: Alex Denning

Quick maintenance mode

Paste the following code into your functions.php file and you will be able to easily implement a maintenance mode on your WordPress blog.

Source: Skyje

Disable theme changing

Simply paste the code in your functions.php file to disable theme changing.

Source: Steve Taylor

Redirect feeds to a single format

Adding the following shortcode to your .htaccess file will let you direct all your feeds to a single format.

Source: Digging into WordPress

Simpler WordPress login url

Adding the following code to your .htaccess file will let you have the simpler WordPress login url.

Source: Kevin Chard

How to modify size of embedded videos

On adding the following shortcode to your theme’s functions.php file will let you modify the size of embedded videos.

Source: Shailan

Photo Credit: Flickr/hackNY.org

WordPress Snippets – The ‘One’ You Don’t Want To Miss

Programming-4

Loading All Posts From The Current Week

The following snippet will allow you to load all the posts from the current week.

Source: MarketPress – Christian Brückner

Breadcrumb Without Plugin

While there are numbers of plugins available to breadcrumb your WordPress blog or website BUT what if you can do the same with simply adding the following snippet at your theme’s functions.php file.

Once done, open header.php and call the function:

Source: emoticode.net

Changing Dashboard Help Tab Contents

Using the following snippet, you will be able to change the contents of your dashboard help tab.

Source: WP Tuts

Automatically Adding Paragraph Tags

While using the wpautop(), WordPress itself add paragraph tags to the content and the excerpt BUT if in case you requires to add paragraph tags to any text automatically, then use the following snippet for the purpose.

Source: Daniel Pataki

How To Login In A WordPress User Programmatically

The following snippet will allow you to login in a WordPress user programmatically.

Followed by, to log in a user, do the following:

Source: evilsocket

Bringing Single-Column Dashboard Back To WordPress 3.8

With recently introduced WordPress 3.8, a whole new way to display the dashboard BUT if in case, you don’t like the way, then adding the following snippet to your theme’s functions.php will let you bring back single-column dashboard.

Source: Jeff Starr

Ordering Posts By Two Meta Values

By default, WordPress allows you to sort results of a query by one meta value, BUT if you want to order posts by two meta values, then adding the following snippet will help.

Source: WP Recipes

Displaying Recently Registered Users

The following snippet will display recently registered users.

Source: emoticode.net

Snippets Collection 5

WordPress

Author Bio Excerpt

The snippet below will let you have the author bio excerpt.

Disable Self Trackbacks

The following snippet will let you disable self trackbacks.

Remove Login Shake

The following snippet has to be added to functions.php and it will remove the “wrong password” screen shake.

Only Show Admin Bar To Administrators

The following snippet will let you show the admin bar to administrators.

QR Code With Article Link

To have the QR-code rendered for every article, just insert the following snippet inside the WordPress loop.

Snippets Collection 4

WordPress

Disable Plugin Updates

The snippet below will allow you to disable plugin updates.

List all categories with posts

The snippet below will let you list all categories with posts.

Override WordPress and Site URL

The following snippet will let you override WordPress and site URL.

Get the first link in post

The following snippet will let you get the first link in post.

Check if sidebar has widgets

The snippets checks that if a sidebar of your website having any widget areas in it or not.

Snippets Collection 3

WordPress

Redirect your Author archive link to your “About” page

The following snippet will let you redirect your author archive link to your website’s about us page.

Change Image Path Only

The following snippet will let you change image path only.

Add Thumbnails in Manage Posts/Pages List

The following snippet will let you add thumbnails in manage posts/pages list.

Checks if the visitor is from mobile device

The following snippet will let you checks if the visitor is from mobile device or not.

Add titles to previous_post_link & next_post_link

The following snippet will let you add titles to previous and next post links.

Snippets Collection 2

wordpress-logo

Temporary Maintenance

The following snippet will let you temporarily close down your site for visits while your website can still be accessed by admins resulting in letting you do the changes that you are planning for

Add featured images to WordPress feeds

The snippet below will let you add featured images to WordPress feeds.

Set Minimal Comment Limit In WordPress

The following snippet will let you set minimal comment limit in WordPress.

Allow PHP in WordPress Text Widgets

The following snippet will allow PHP in WordPress text widget.

Snippets Collection 1

WordPress

Remove URL from Comment Form

The following snippet will let you remove URL from comment form.

Display a Random Post

The snippet below will let you display some random post.

Customize the Default Avatar

The following snippet will let you customize the default avatar.

Create a Custom Post Template

The snippet below will let you create a custom post template.

Limit Number of Post Revisions

The snippet below will let you limit number of post revisions.

Snippets Collection 5

WordPress

How To Set A Maximum Word Count On Post Titles

Adding the following snippet to your theme’s functions.php file, you will be able to set a maximum word count on post titles.

Snippet Source/Credit: Pippin

Displaying WordPress Excerpt Dynamic Length

The following snippet display the WordPress excerpt dynamic length.

Snippet Source/Credit: Snipplr

Delete Width And Height Attributes From Image Tag

The following snippet will let you delete both width and height attributes from image tag.

Snippet Source/Credit: Stackexchange

How To Set Basic Tag Cloud In WordPress

The following line of code will let you set basic tag cloud in WordPress.

How To Know That Which Theme You Are Using

Adding the following lines of code will let you know that which theme you are using.

Snippet Source/Credit: Snipplr

How To Change Editor Font In WordPress

The following snippet will let you change editor font in WordPress.

Snippet Source/Credit: DevPress

Page 1 of 12

Powered by WordPress & Theme by Anders Norén