and like us on FB

Anybody with a WordPress website should have a custom functions plugin… and operating without one is fraught with potential problems. This post serves as a landing page for our custom functions plugin, but also includes our argument for why it’s required (and why it’s installed on every website we work with). We’ll be referencing this post from other code-focused articles in the future.

The custom functions plugin is designed primarily to support WordPress shortcode. If you don’t know what shortcode is, see this post.

There are a number of problems with using multiple plugins. It’s not uncommon for WordPress users to install a plugin for a particular feature when a single small snippet of code often provides the same functionality — without bloated administration pages and other superfluous code. While plugins are a perfectly acceptable means of providing features – and indeed the WordPress framework takes on a minimalist approach because it has such an active base of plugin developers – having too many plugins can seriously compromise on your website load speed and SEO. While the number of plugins that you should (or shouldn’t) have installed varies from one developer to another, they all tend to agree that “the fewer the better”.

Multiple plugins are expensive – meaning that they compromise on CPU usage and memory every time a page is served. One method of mitigating the need for multiple plugins – particularly when the plugin provides a simple feature – is to simply copy the necessary code into your custom functions plugin. It’s not uncommon for the custom functions plugin to provide a sanctuary for code that would otherwise translate to dozens of plugins.

You shouldn’t ever edit core files. While you can simply copy necessary code from time-to-time into an existing functions.php file associated with your theme ; the problem with this is that when you update your theme you’ll invariably overwrite the custom code you’ve copied. Additionally, you should never edit core WordPress files; there’s always almost always a means of navigating that need with WordPress hooks, actions, and filters – all of which can be coded into your custom file to make your website more modular, extensible, and functional.

The custom functions file is portable. If and when you alter your theme you may simply copy your custom functions plugin from one WordPress installation to another – meaning that the features you’ve coded into your website won’t be interrupted. Additionally, one single change in the functions file will impact all instances of the shortcode on your website (one of the primary benefits). For example, if you have shortcode to display a YouTube video and you have the width set to your post container of 400 pixels… but then you change to a theme with a post container with a width of 600 pixels, changing a single shortcode attribute in your custom code will scale the video globally.

Keeping your custom code in a plugin means all your little custom snippets and functions will never break or be compromised by any kind of upgrade. Best of all, if you decide to start another website, you can simply copy across the plugin and all your custom functions and shortcode will immediately be available.

Title: Custom Functions Plugin
Description: The custom functions file gives you control over shortcodes, hooks, filters, actions, and other WordPress code.
Download: WP Plugin (V0.1) | | Plugin Page

Shortt URL for this post: http://shor.tt/9R7