Creating an Animated Submit Button for Ninja Forms

Ninja Forms is easily one of my favorite WordPress plugins. It’s one of the most design agnostic form building plugins I’ve come across and saves me time on every project. Every now and then a designer asks for some UI that isn’t easily accommodated by most form markup. If you have ever tried to style a <input type=”submit” value=”Submit” /> you know what I’m talking about. A couple projects back I needed to animate a submit button with a fancy hover effect and an icon font. I had already styled some anchor markup with the same effect (Codepen below) and was hoping to apply it to the sites forms with relative ease. http://codepen.io/philhoyt/pen/VjzjjR I reached out to the WP Ninjas team and they were extraordinarily helpful in pointing me in the direction of Custom Field Templates, which I was previously unaware of. Below demonstrates how to set up your own Custom Field Template, I am creating a Submit button, but this works with other field types as well! If you are creating your own themes, you can simply create a “ninja-forms” directory, “templates” directory, and a “fields-submit.html” file inside of your theme as shown below and you’ll be all set to continue. ninja-forms-custom-template-directory   If you are using a Child Theme, create the same folder structure, but will also need to add the following code in your functions.php file for Ninja Forms to recognize the template directory. More information here. ninja-forms-custom-template-directory-child-theme https://gist.github.com/philhoyt/efa932256a052d65f769fb10dda0508d Inside of the “fields-submit.html” file, I am going to take the markup from the animated anchor link in Codepen and modify it to accept information from Ninja Forms. You can, of course, use your own markup. https://gist.github.com/philhoyt/d6d36aca6c14f235df8287f94fd379c4 Then I took the CSS from the Codepen and place it in style.css, as well as called Font Awesome in functions.php, wpbeginner has a great tutorial on adding Font Awesome here. Now when you visit a form on the site you can see the new submit button in action, before and after picture below!

Before

After

Using Advanced Custom Fields to create Post Titles

Advanced Custom Fields - Post Title

I often need to create post titles in WordPress based on fields I’ve generated using Advanced Custom Fields. Below is an example that assumes we have a Custom Post Type registered to “staff” and two Custom Fields with the name of “first_name” and “last_name”. Using the “update_value” hook provided by Advanced Custom Fields and “wp_update_post” I am able to update the Slug and Post Title using the values given in the respective fields.

Disabling the title at a custom post type level will, unfortunately, remove the clickable permalink below the title that I often use. To combat that I create a very simple metabox with the permalink. Demonstrated below.

How WordPress default themes add Google Fonts

I spent some time diving into Twenty Seventeen in preparation to develop for the theme directory. I was curious as to how the developers of very popular theme would enqueue a Google Font. I am no stranger to using a @import tag in the stylesheet, but I assumed there had to be a more sustainable solution. What I found was a thoughtful way of adding a font which I have digested into a gist below.

Handling your Google Fonts in this manner allows translators of your theme to disregard a font that may hinder the translation.

If you are in a similar position as I am, trying to sharpen your WordPress skillset, I highly recommend tearing into some of the default themes. They are a plethora of knowledge.

Free Plugins to Enhance your WordPress Experience!

wordpress-plugin

The WordPress UI is one of the best CMS’s on the market and continues to improve with every version. That being said there are a few features that seem to be missing which could make your experience a whole lot better and I am going to show you a few plugins to fill that void!

Media File Sizes

file-media-size

The Media Library leaves a lot to be desired, with Media File Sizes we can add a new column showing the file size of your media. Allowing you to sort by size and identify any media that might be taking up a bit to much space on your site and possibly causing slow load times.

Check out Media File Size

Enable Media Replace

enable-media-replace-wordpress

Sometimes you upload an image and realize it needs to be replaced, maybe you’ve already posted it in a few places on your site. By default, WordPress doesn’t give you a way to swap it out with Enable Media Replace you can replace your media sitewide! (Note: I have experienced some weirdness when used in conjunction with Jetpack’s Photon)

Check out Enable Media Replace

Duplicate Post

duplicate-post-wordpress

I find Duplicate Post particularly useful when dealing with posts that have a large amount of custom fields or sites using page builders. You find yourself creating a bunch of pages with similar layouts or content and instead of having to copy and paste or dragging and dropping over and over again you just want to make a duplicate and change the content our a bit. Duplicate Post solves this!

Check out Duplicate Post

Disable Title

disable-title-wordpress

I often find I don’t want my page headline to be what the title of the page is. There are a few ways to solve this, but I’ve found the least involved process is to disable the title and add my own H1 heading in the editor and with Disable Title you can do that!

Check out Disable Title

Adding a ‘Client’ User Role to WordPress

In an effort to make a better boilerplate my co-worker Jim Floss and I set out to create a new User Role inside our WordPress client sites. This role closely resembles the Editor role and Admin role, but allows us to turn different functionality on a per-client basis if need be, but by default locks them out of many things such as updates and plugins. I didn’t see much information on cloning a role and removing functionality online so I figured I would put it up here! Enjoy.

/**
* Adds a 'Client' user role
* https://codex.wordpress.org/Roles_and_Capabilities
*/

add_action(‘init’, ‘add_client_role’);

function add_client_role() {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();

$adm = $wp_roles->get_role(‘administrator’);
//Adding a ‘new_role’ with all admin caps
$wp_roles->add_role(‘client’, ‘Client’, $adm->capabilities);
}

add_action(‘init’, ‘revoke_client_capabilities’, 10);

function revoke_client_capabilities() {
$caps_to_remove = array(
‘update_core’,
‘activate_plugins’,
‘install_plugins’,
‘update_plugin’,
‘edit_plugins’,
‘edit_themes’,
‘export’,
‘import’,
‘create_users’,
‘manage_options’,
‘switch_themes’ // etc
);
$custom_role = get_role(‘client’); // Edit according to your role as it was declared when added
foreach($caps_to_remove as $cap) {
$custom_role->remove_cap($cap);
}
}

BackupBuddy saves the day… again.

Three years ago, I joined an agency that up until my arrival had been manually migrating their WordPress sites. This processes usually involved pulling down all the site files through FTP or compressing them through shell on a development server, exporting the mySQL database through phpMyAdmin, uploading the site files to the live server, modifying some sort of config file, importing the mySQL database to the live server, edit a few tables in the database to reflect the live information, and followed up with a find and replace in all the content (usually with a lot of praying and cursing in between). Several hours and failed migrations later I determined there had to be a better way.

After a few Google searches the answer was obvious. Enter BackupBuddy!!! BackupBuddy by iThemes claims to have the best way to back up and move a WordPress site and I would agree. After using the plugin for a few years, I have easily migrated 50+ sites.

So why am I writing about how amazing BackupBuddy is today? Generally speaking I use BackupBuddy to migrate developments sites usually no larger than 500mb in size. Well, today I needed to move an existing site that came in around 2.5GB in file size and an uncompressed database of over 500MB to a development environment to work on. Think of it as if I duplicated a shitty car, park it into my garage to work on, then burned the old car to the ground, and rolled the now fixed car out of the garage. Now until now I had never attempted to migrate a site of that size with the plugin, usually because the existing site would be coming from some shitty server that wouldn’t be able to handle it. The success of a migration has a lot to do with the quality of where the site is currently hosted. But I had few options this time around as I did not have access to the servers databases. So I fired up BackupBuddy and ran a backup which the first time around halted at around 2.4GB of file backing up, which is damn good, but unfortunately the server wasn’t powerful enough to capture the whole thing. So then option two, I pulled down all of the site files, moved them to the development server, then ran BackupBuddy to backup the database only, followed the BackupBuddy instructions to migrate, and SUCCESS. A WordPress site with about 10,000 posts with large amount of images successfully migrated.

So buy BackupBuddy (Note: this was not paid for or sponsored by iThemes, I just really like the plugin.)

I’ll be speaking at WordCamp Ann Arbor October 4th, 2014

wordcamp_ann_arbor_badge

Very similar to my last talk in Columbus, i’ll be speaking on using Frameworks and Child Themes in your development process to create a more sustainable result. This is primarily a Developer/Workflow track talk, but I think anyone who tinkers with WordPress Themes would benefit. If you have never been to one of my talks you are in for a fast talking, loud, cussing, short guy pacing back and forth. I hear Ann Arbor is gorgeous and look forward to speaking, showing, and Q&A with everyone! See you at WordCamp Ann Arbor.

For more information about WordCamp Ann Arbor visit their site.

5 Free Plugins Everyone With a WordPress Site Should Be Using

I have been developing WordPress sites for a long while now and have found a handful of plugins I couldn’t live without. I list them below in no particular order. I would love to hear what some of your must have plugins are in the comments.

WordPress SEO by Yoast

Do you like traffic to your site? Do you not have WordPress SEO by Yoast install? WHAT IS WRONG WITH YOU GO INSTALL AND CONFIGURE IT NOW! WordPress SEO by Yoast is the go to plugin to optimize your site for search engines. Easily edit page titles and meta descriptions, create xml sitemaps, modify robots meta, clean up your head section and much more. Also Yoast just partnered with the web security company Sucuri so you know it is legit!

Download Here

Stream

Update 4/30/15: I am putting this one on the bench for a while, will revisit soon.

Ever have a team member or client change something on your site, but can’t figure out exactly what, where, or when? Well Stream solves all of that by tracking every little move you make inside of WordPress including auto updates and displays the data in an easy to read and filterable manner. Never again will can a client call up yelling that you broke something on their site when in reality they uninstalled a key plugin.

Download Here

iThemes Security

Update 4/30/15: I have since found iThemes Security to be a bit buggy, I recommend reading the Hardening WordPress info as well as developing and maintaining a tip top WordPress install.

Somewhere out there is a someone or something trying to ruin your day right now. Hackers, bots, malware, and a slew of other nasty bullshit is trying to destroy all your hard work. Protect yourself with iThemes Security. iThemes Security protects your site against brute force attacks, common WordPress security flaws, banns known offenders, detect file changes, and so much more! If you are running a site without this plugin installed you are asking to be hacked. Just do me a favor and install it right now.

Download Here

WooSidebars

They way sidebars and widgets are currently handled in WordPress could use an overhaul. They have since outgrown their original purpose and are now being used to serve up large amounts of dynamic and custom content on a per situation basis. While WordPress core has done little to assist in these features a handful of plugins have come to ease the pain. I have used a fair amount of plugins to handle custom widget areas ( Display Widgets / Sidebar & Widget Manager ) none have been as simple and lightweight as WooSidebars.

Download Here

Akismet

Akismet is an anti-spam plugin that comes installed on every WordPress site installed. So why are so many of us guilty of never activating it? Is it because it requires you to associate it with a WordPress.com account which would take a whole 5 minutes of your life to sign up for? I guess you just like huge amounts of spam piling up in your database filled with malicious links and link bate galore? I will admit from an agency perspective it is a little bit of a pain to set up Akismet on every single site we build, but it’s benefits surpass that folly.

Download Here

WP Decoded Podcast

I was able to hop on the very first WP Decoded podcast to talk about WordPress Columbus 2014 and WordPress 4.0! Unfortunately, had to take the call from my car so my signal was poor and was dropping in and out with a bad delay. Hopefully, no one thinks I was talking any derpier than I usually do!

Watch the podcast below and get more information about WP Decoded right here.