- September
Posted By : Code Buddy
Comments Off on Top 5 Custom WordPress Functions to Add to Your Site
Top 5 Custom WordPress Functions to Add to Your Site

WordPress is used by so many websites because it has so much flexibility. You can create as many WordPress functions as you’d like and you can make your site do just about anything.

WordPress runs about a third of the top websites online. It’s easy to use, and easier to customize.

You don’t have to stick with a particular theme just because that’s what’s given. You can customize many functions in WordPress and make it your own. Keep reading to learn how you can add customized WordPress functions to your site.

How to Add Functions to Your Site

There are two ways you can add functions to your site.

The first is through adding custom code into your theme. The second way to add customizations is through plugins. Plugins are little pieces of software that perform specific functions.

There are over 56,000 plugins available for WordPress. They can help boost your site’s SEO, make it run faster, compress images, and much more, depending on what you’re looking for.

If you have a need, there’s a plugin for it.

The upside to using plugins is that they require little to no programming experience, but they allow you to add some pretty cool functionality to your wordpress site.

The downside is that they can make your site slow and bulky. This happens with poorly written plugins and when you have too many plugins installed.

Custom code can when written well, perform various WordPress functions.

It’s up to you to decide what’s worth coding yourself and what should be solved with a plugin.

Start With a Child Theme

If you plan to do any hard coding of your theme, you need to create a child theme.

A child theme is essentially a theme that takes all of the functionality of the parent or main theme you’re using.

This is a must-have when you create customizations in WordPress. When you hard code files like functions.php or style.css, those customizations are overwritten anytime your theme or WordPress issues an update.

You’ll have to re-code everything, every single time there’s an update.

With a child theme, you make your customizations in the child theme’s files and they stay regardless of updates.

Top 5 Custom WordPress Functions

Once you have your child theme in place, it’s much easier to create custom functions in WordPress.

Some themes have places where you can add your CSS code, and the changes will be made to the theme.

If your theme doesn’t have this option to add code, you can create that possibility via plugins such as Code Snippets or My Custom Functions.

The other option is to go into your WordPress dashboard and then to Appearance -> Editor.

You’ll then bring your child theme and make the changes you want to make there.

Here are the top 5 changes that are made most often.

1. Changing the Header & Footer

If you don’t like the standard header and footer in your theme, you can always change them.

You can add code via the Header, Footer and Post Injections Plugin or you can do so manually.

To do so manually, go into the backend of your website via CPanel or FTP. Copy your header.php and footer.php files from your parent theme to your child theme.

Your code will look like this:

/* Description of what the code does */

add_action(‘wp_head’, ‘your_function_name’);

function your_function_name(){



That’s how you can use this custom function to change the standard image sizes on your site.

3. Change Excerpt Length

When you have a blog, you’ll notice that you have one page that summarizes all of the blog posts.

They’ll usually have the featured image of the post, the title, and an excerpt of the post.

In WordPress, that excerpt is usually the first 55 words of your post.

You can create longer excerpts in WordPress by adding this code to your functions.php file in your child theme.

/** Explain what your code does here. */

functionnew_excerpt_length($length) {

return 100;


add_filter(‘excerpt_length’, ‘new_excerpt_length’);

You can modify your excerpts by changing the number 100 to whatever you’d like.

4. Add an Author Box

If you have a site where you have several contributors, or if you want to tell first-time visitors more about you, an author box is a great way to do that.

It’s a little complex to do, and you’ll have to add the code and CSS to your functions.php file.

The code is pretty complex for beginners, and in this case, you could be better off with a plugin.

Two plugins that are lightweight and easy to use are Smart Author Widget and Simple Author Box.

5. Google Analytics & SEO

Finally, you want to set your WordPress site up so it’s ready for Google Analytics so you can track and measure your site’s traffic.

You always want to have your site set up for SEO.

Fortunately, this requires no programming. You just have to install a couple of plugins.

Google Analytics requires that you add code to your theme’s header to connect your site to Google Analytics.

When you do that, the code has to load first and slow your site down. You can avoid that scenario by installing the CAOS plugin.

For SEO, there are two plugins that set the bar for WordPress SEO. The first is All-in-One SEO.

The second is SEO by Yoast.

Both have excellent functionality when it comes to getting your site ready for SEO. They’ll help you create title tags and meta tags that are optimized for your keyword.

Customize Your WordPress Site Today

WordPress is loved by developers and newbies alike due to its simplicity and for its ability to be customized.

With the right WordPress functions, you can do just about anything you want to your site to fit your needs. You either have to learn to code it yourself or install one of the thousands of plugins available.

If you want more tips on how to work with WordPress, visit our blog today.