Using CustomPress for the First Time

Today I wanted to walk you through using the Custom Press plugin for WordPress.  Now for those of you who aren’t or have little to no interest in coding, relax, and don’t break out into a cold sweat this isn’t going to be one of “those” articles.  Custom Press is a Plugin that allows you to customize WordPress Post Types (meaning what we would normally call “posts” and/or “pages” in WordPress) so that you can customize to your heart’s content.  It also gives you plenty of control over taxonomies (meaning categories for your custom post types).

Let’s dive into how you can first of all create custom post types and taxonomies so that you can use them in your site and also how you can embed them once you’ve created them.  Sit back and enjoy the screenshots.  Once you’ve done the hard work of installing the plugin (and by the way its not hard at all)  the next thing to do is to find it and configure it.  Most plugins that you install create their own heading in your WordPress backend dashboard however Custom Press doesn’t.  It creates the sections for Post Type and Taxonomies under the “Appearance” section for your theme as you can see below.

Step 1: Creating a Custom Post Type

Creating a custom post type is not that hard using Custom Press.  Click on the “Post Type” option and you will be taken to a page like this…

From here enter the name using a standard naming convention, the plural and singular label of the post type and a description about the post type and click “Save“.  What you will notice after saving your custom post type is that you will have an option in your left side navigation menu representing your newly created custom post type just like what you see below.

When you click the “Add New” option from the menu you’ll be brought to a page that looks a lot like the standard post and page post types with a few exceptions including the fact that the name is related to the customer post type that you created.

Step 2: Creating Taxonomies

Taxonomies are important for creating your custom post types in that they outline the categorization of your custom post types.  For example, if you create your custom post type called “Books” using Taxonomies you can outline genres, price points, authors and languages using a taxonomy structure.  The best way to think of taxonomies is to think of it like a category, something I am sure we are all familiar with and use it that way.  Let’s have a look at setting up taxonomies.

As you can see above all you need to do is set the taxonomy name, singular and plural labels and select the post type you want to apply it to whether its a standard post type like a page or post or a custom post type like we talked about previously.

Once you’ve saved your taxonomies you can start to use them in your post types to build out your hierarchy.  Lastly I wanted to show you just how to embed these custom post types and taxonomies into your WordPress website.

Step 3: Embedding your custom post types and taxonomies into themes and plugins

The real magic behind using Custom Press is the fact that you can take the post types and taxonomies and start to include them into your website.  In order to embed the post type or taxonomy you’ve created into your website in any custom manner you need to hover it first.

When you click “Embed Code” you’ll notice that it generates code which you can then embed into the functions.php file of your WordPress theme.

Now that I’ve  shown you how you can customize WordPress using custom post types and taxonomies I urge you to check out the Custom Press plugin to customize your WordPress website.

 

How to Code Forms That Validate Using HTML5

I wanted to share a tip with you for those of you who have websites that run on HTML5.  Traditionally in HTML 4 and its predecessors if you wanted to do validation on web based forms on your website that collect information from your visitors you had to reference and/or code JavaScript that would then validate what a user enters onto the form when they submitted it.

Now with HTML5 you can do a number of things to validate your website’s forms from simple validation by making a field required to adding fields on your web form that are structure specific like email fields and others.  Let’s have a look at a few examples starting with simple form validation.

<input type=”text” required>

When using the “required” attribute in HTML5 what this does is makes this field as required using boolean logic. Simply set it up with the required keyword and you are done.

Now let’s look at a few more input types to help you validate your website forms using HTML5 including email and url.

<input type=“email” …/>

The email input type field on a web form looks at the structure of what is entered to ensure that it follows the structure of an email address whereas the url input type checks to ensure that the characters entered in the text field use the structure of a url.

<input type=“url” …/>

I hope that these tips help your website to use the features and functions of HTML5 to make things easier for you and your website.

How to Create Hooks in WordPress

The problem with making changes in WordPress is that you need to make them to the core files.  What a pain in the butt, right?  Well let me tell you about the beauty of using hooks to customize your WordPress theme.  A hook in WordPress gives you a way to write over some of the core functionality of WordPress in order to edit a WordPress theme so that you can make changes but you don’t necessarily need to make them to the core files.

So what is a hook anyways?

These hooks can be written in the functions.php file in the wp-content/themes/yourtheme directory for those of you developers looking to code.  Normally what a hook does is it “hooks” a standard function to some custom functionality in order to “overwrite” the standard functionality without the need to modify code.  Pretty cool eh?  So what does a simple hook look like?  Have a look below at an example…

add_action ( ‘publish_post’,'superCoolFunction’)

As you can see the standard function of ‘publish-post‘ which means that when the ‘publish-post‘ is executed that is hooked to ‘superCoolFunction‘ this function is also executed.  So now that you know the basics of hooks in WordPress let’s talk about some ways that you can use them in your WordPress site using some plugins that have been created to help you implement hooks fast on your website.

A plugin that you can use on any WordPress theme to create hooks

One great plugin that is not theme or theme framework dependent is WP Hooks, a pretty basic and highly powerful way to add hooks into the header and footer areas of your WordPress site.  Have a look at it below in action or feel free to get more information by clicking here.

 

Hook Plugins for Themes and Theme Frameworks

It seems as though the guys behind some of the best themes and theme frameworks have put some thought into creating plugins that do more than just the basics that WP Hooks plugin that I mentioned above.  Here are some great plugins that you might want to consider when purchasing your next theme or theme framework.

Genesis Simple Hooks Plugin


 

The one great thing that this plugin offers is the ability to add a hook in just about anywhere you could possibly want to in a WordPress Theme.  However, this plugin is just for specific use with the Genesis Framework so if you are using this on your WordPress theme currently you’ll be able to use Genesis Framework for free.  Click here to get it!

Thesis OpenHook Plugin

Thesis is another WordPress theme that you can purchase.  This plugin was created so that you could have the functionality of creating hooks without the mess of coding them all by yourself.  Click here to get it!

Hybrid Hook Plugin

This plugin is designed for use with the Hybrid themes.  The Hybrid theme itself is a free WordPress theme with the option to use any number of child themes that have already been developed for it.  It’s definitely worth looking at if you want to use WordPress but don’t want to spend any money on a theme.  Click here to get it and get the Hybrid Hook plugin too!

K2 Hook up Plugin

This plugin can be used with the K2 WordPress theme which is also a free theme.  Much like the Hybrid theme, you can download this theme and use the K2 Hook Up plugin to create your own WordPress hooks.  Click here to get it!

Whether you decide to create your own custom hooks using the functions.php file in WordPress or use one of the plugins I’ve mentioned above, if you learn to master using WordPress hooks you’ll save yourself a lot of headaches and potential problems updating and making changes to your WordPress website.


How to Code your wp-config.php file in WordPress

Whether you are new to WordPress or you’ve been using it for many years like me then you know that when you install WordPress you’ve always got to work with the wp-config file.  Just like it sounds the wp-config file is a PHP file that tells WordPress where and how to configure WordPress with your mySQL database.

Now this can be daunting for many people considering creating a WordPress website that they host on their own servers under their own domain name (The other less invasive way is to go to www.Wordpress.com and create a wordpress website this way but you won’t have control over the domain name or hosting because WordPress.com hosts it all!) considering that you need to know what and how to code this PHP file in PHP and deploy it to your website.  Now, for those of you who are brave enough to learn a little PHP please keep reading.

When you get down to editing the wp-config file you will need to be able to provide information about the mySQL database including the database name, the user name, the database password and mySQL hostname also known as the “localhost” by some web hosting companies.  The next thing you will need to edit the “wp-config-sample.php” you’ll need to save it as “wp-config.php” for it to work correctly.  Below are some of the fields you will encounter in the wp-config.php file…

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘putyourdbnamehere’);

/** MySQL database username */
define(‘DB_USER’, ‘usernamehere’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘yourpasswordhere’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

In order to locate the values for these fields you’ll need to access your web hosting account and either create a mySQL database or access an existing mySQL database in order to get this information.  Once you have this information simply add it to your wp-config.php file, save it and upload it to your web hosting account and you’ll be good to complete the installation process of your hosted WordPress website.

 

Showing and Hiding Sidebar Content in WordPress Blogs

This is just a cool little trick that i thought I’d include for all you WordPress lovers out there.  When it comes to managing a website or blog today at some point you may want to show or hide certain content depending on the page your visitors are on or for some other reason (e.g. “someone purchasing ad space on your website”, etc.).  With WordPress it’s entirely possible to hide certain content on various pages and have that content only appear on specific pages.

So with that understanding, if you want to only show a particular piece of content on the homepage of your WordPress and NOT have this content appear on any other page you can use the following snippet of code…

<?php

if (is_home()) { ;?>

<a href=”">Your link here</a>

<?php } ?>

 

Another option to code content to only show in the front page of your WordPress website is to code using the following snippet of code…

 

<?php

if (is_front_page()) { ;?>

<a href=”">Your link here</a>

<?php } ?>

 

Lastly, if you have content that you only want to show on a certain page (for example the “About” page) then you can use this code snippet…

 

<?php

if (is_page(‘about’)) { ;?>

<a href=”">Your link here</a>

<?php } ?>

Note: keep in mind that the above mentioned code snippets are useable with the standard WordPress functionality.  You’ll need to test to see if they work with your customized WordPress theme to ensure that they work.

Now you can hide certain content on your WordPress website depending on what and where you want to hide it!