How to Customize Any WordPress Theme with WP Snippets

357 Flares Twitter 259 Facebook 38 Google+ 9 LinkedIn 2 Pin It Share 17 Buffer 31 StumbleUpon 1 357 Flares ×

"How to Customize Any WordPress Theme with WP Snippets"

It is hard to recognize the theme that I originally downloaded for free on my website. I have added enough custom tweaks with WordPress Snippets that the original developer probably would be very upset. I have learned a lot from doing this though and it has helped me with my business. By learning how to implement WordPress snippets you can add almost any feature you would like.

The WordPress Codex

The WordPress Codex is the name of the online document that lists all the PHP code functions that come included in a default install. Every theme has these abilities. Your developer decided how to implement them and in what way. Consider it the handbook that will help you get out of any tricky situation.

This is what makes WordPress such an ingenious platform for bloggers. It is open source, so anyone with some time on their hands can learn how to develop a theme. Your primary tool will be PHP. Snippets are going to become your best friend.

Important WordPress Templates

Arguably, there are several documents that you will modify the most when you make changes to your blog.

index.php ¨C This document controls the “blog” layout page. The one where people can see a listing of your most recent posts. 

single.php- This template controls the actual layout of an individual post.

page.php- This is one is responsible for the way pages look.

functions.php- This is the big one, has many uses and we will be using it a lot in the following examples.

Before you make any changes, back up your theme! I simply copy and past the php files into a new text document. Save it with a php extension and you will have a back up copy. If something goes wrong, upload the originals into your directory (usually accessible from cpanel or a ftp client).

Finding WordPress Snippets

This is not that hard, typing a simple search will find you many of the most popular ones. These are my favorite resources.

  1. WPRecipes
  2. WP-Snippets

There is strong support in the development community, and they like to share. This great for people who want to learn. Lets look and analyze one snippet.

From WP-Snippets

This code will add a custom message to the end of your RSS feed. You simply add it to your functions.php file.

<?php

if ( !function_exists(‘custom_feed_footer’) )

{

      function custom_feed_footer($content)

      {

            if(is_feed())

            $content .= ‘Your text’;

            return $content;

      }

      add_filter(‘the_excerpt_rss’, ‘custom_feed_footer’);

      add_filter(‘the_content’, ‘custom_feed_footer’);

}

?>

 

Lets break it down

 

<?php- This tells the browser that this is the start of the code.

 

If Function Exists- This creates a new php function.The name is “custom_feed_footer”. Technically you can call it anything you would like.

The middle of the body determines what our function actually does. Here it says, if you are a feed then add “your text” to it.

The Filters “hook” the functions to one of the WordPress properties.

Lastly ?> declares the code is done.

Once you start experimenting with snippets you will love the freedom it brings. It does take some bravery, you can use Instant WordPress to learn. It creates a local install and you can practice hacking your theme. Once you are comfortable with your changes, and you know it works, you can add the code to your website.

Image Credit : blurbherd

Susan Silver
She lives by the philosophy that no one is a better "Me" than herself. We are all experts on our personal experiences. She applies this to her copywriting craft to bring out the personalities of her clients, giving them a unique brand.
Susan Silver

Latest posts by Susan Silver (see all)

Advertisement

Web Hosting

2 Comments

  1. DebbyBruck says:

    Dear Susan. This is one of the finest blogs on ModernLifeBlogs website. Thank you so much and I’m looking forward to more of these helpful articles. Blessings, Debby

    • Susan Silver says:

      Glad you enjoyed! People rarely explain what the heck snippets do when they use them. But, they are so helpful. I hope more people will be brave to start hacking and learning some tricks they can implement.

Leave a Comment

357 Flares Twitter 259 Facebook 38 Google+ 9 LinkedIn 2 Pin It Share 17 Buffer 31 StumbleUpon 1 357 Flares ×