Add custom functions the easy way

It never fails. You’ve finally found the solution to your WordPress woes. You must insert lines of code into your functions.php file.

No way! No how! Not doing it! Instead, you resign yourself to just live with whatever issue you just spent hours trying to fix.

Well, if you want an easy-peasy solution, read on.

Custom Functions made easy!

The easiest way to add custom functions to your WordPress site is to install the My Custom Functions plugin by Arthur Gareginyan. It is the path of least resistance for non-coders. Plus, it’s just easier if you only have a handful of functions to add!

Install and activate the plugin, you will find a “Custom Functions” entry under the Appearance tab in your Admin menu.

The plugin provides an area where you paste any PHP code you want. It even provides a safety net to prevent you from breaking your site with syntax errors or bad code.

Now you can go forth and add custom functions without fear!
Okay, you can add custom functions with LESS fear 🙂

Center content on a web page

Need a simple way to center content on a web page? I’ll show you 2 simple ways, and surprisingly, they are embroiled in much debate.

Center Content Method 1

Most casual bloggers commonly use the <center> HTML tag to center content. Here’s an example:
<h1>Your Header</h1>
<p>Your text.</p>
<img src=”URL to your image”>

The above code gives you the following result:

Your Header

Your text.

Unfortunately for those that favor this methodology, the <center> tag has been deprecated and at some point will simply stop working.

Center Content Method 2

An alternative way to center content is to add the following class to your CSS:
.text_center {text-align: center;}

And then use your new CSS class in your HTML:
<div class=”text_center”>
<h1>Your Header</h1>
<p>Your text.</p>
<img src=”URL to your image”>

Your Header

Your text.

Both ways are pretty simple to accomplish, although the second does require an extra step.

Why ruin a good center content?

So why was the <center> tag deprecated?

The experts say HTML is a language that should only describe the content NOT define the presentation of the content. CSS is the language that defines the presentation. At least that is how it is supposed to work.

Casual bloggers just want quick, easy solutions that work. The simpler, the better! They don’t really care about the self-imposed rules that the technical folks use to try to maintain order in the wild west web development world.

Here’s the rub. The powers that be created a language with so much flexibility that you can craft a solution by simply throwing tags around stuff and adding some inline styling (another thing the experts frown upon).

I’m not sure what they expected when they turned the world loose on the HTML built internet. Humans are resourceful and will find many ways to accomplish their goals, even if those ways aren’t the best ways.

For more CSS centering examples, check out these Tips and Tricks from W3C.