WordPress Experts offering WordPress Consulting

It seems a new professional title is being thrown around out there, “WordPress Consulting” is now turning into a hot profession, and knowing the ins and outs of this amazing software can lead to a full time job.

Claiming the title myself, I decided to specify what this means to me.

A WordPress consultant is – in the most simple form – a WordPress expert, with a skill-set branching off into different areas of internet marketing. They sleep, eat, and dream WordPress. Okay, that may be a bit carried away, but the truth is, when it comes to anything, working with an expert in the field is how you get your business or skills to next level.

Huge companies, higher education institutions, and government agencies utilize WordPress as a platform for their website including, but certainly not limited to:

  • Wall Street Journal Blogs
  • Mashable
  • The Rolling Stones
  • CNN Business Blogs
  • Estee Lauder
  • Techcrunch
  • 500 Startups
  • Harvard Gazette Online
  • Dave Mathews Band
  • Kangol

In-fact, companies both large and small are switching over to WP for various reasons.

The need for experts is ever-growing.

WordPress may be “easy to use”, but if you are looking to utilize the full power of WordPress, require advanced functionality, or simply do not want to deal with any of it… and be rest assured that everything is running at top notch, then checking into WordPress consultants may be for you.

Although WordPress has been around since early 2003, the demand for WordPress Consultants has caught on and is steadily increasing. Over time,  more people started using WP, and as the platform grew to be more of a CMS platform – rather than a basic blogging solution.

With a new and growing industry like this – and with more and more websites moving over to the WordPress platform – its no wonder experts in the industry are stepping forward to feed the demand.

So What Can a WordPress Consultant Do For You?

Those who call themselves by this title may be able to offer a number of skills and guidance. Quite often, they have a background in web-design & development, custom scripting(php, css, html, js and more), internet marketing, and general business skills. This obviously varies by the specific consultant or firm that you are working with. Most importantly, they specialize in WordPress, both on the front-end and back-end.

They know how WordPress works and how to make it work for you.

Design – Are you looking for a custom theme design or modifications to an existing theme? This is no place for a novice, and getting the right direction as to reliable WordPress developers can save you a tremendous amount of time and future problems. A WordPress Consultant will be able to assess your needs, and either be able to provide you with the service, or point you in the right direction of some qualified candidates for the job. These guys (and gals!) are usually very active in the WordPress community, and familiar with the system inside and out…but if they cannot directly help you, they’ll personally know someone who can.

Security – Web security is in a league of its own, but more importantly, WordPress specific issues are a beast of another nature. Although extremely secure… poor configuration, lack of maintenance and other loop-holes can let the bad guys in. When this happens, you’re in trouble, and your business or image will likely take a hit. WordPress Consultants are generally very knowledgeable about the current and past vulnerabilities, what to lookout for, how to be proactive in protecting your site, and even be able to assist and recover if you were to get hacked. This is an area that you do not want to leave in the hands of a beginner, or yourself.

SEO – WordPress preaches “great seo capabilities” out of the box, and it does – but having dense knowledge about both WordPress AND seo can provide great results beyond your expectations. Ensuring everything on your site is configured correctly, as well as making sure your other online efforts are properly connected is extremely important when trying to rank well in search engines, and get ahead of your competition. Just installing an SEO plugin does not solve anything. A WordPress Consulting expert would be experienced in all aspects of seo, and the constant changes that are made to the algorithms to ensure you get to the top of search engine results, and stay on top.

Speed – Speeding up your WordPress site is not always an easy task. There are many variables, and techniques that can greatly improve the performance of your website. A fast loading website not only keeps your visitors happy(and on your site), but search engines are beginning to take “page load time” into a ranking factor. Optimizing the websites resources, ensuring the cleanest code, and managing which plugins should or shouldn’t be used and how to use them most efficiently is something you definitely want to leave up to a WordPress specialist.

Hosting Recommendations – Hosting your WordPress site isn’t as easy as signing up for a $3/month shared hosting package and forgetting about it. Well it is if you aren’t concerned with security, accessibility, and growth.  Shared hosting can be great for a first website, and if set up with best practices in mind. A WordPress consultant will be able to give you the best recommendations for hosting your WordPress driven site depending on your specific requirements and future plans.

Deep analytics & Conversion optimization – Getting visitors to your website is only half the battle. Ensuring those visitors are turning into customers or potential business relationships is very important. A WP Consultant is usually quite savvy on how visitors do and should interact with your website. They can take the data extracted from your analytics program, draw a hypothesis, and apply some intelligent changes to your website that will help your overall engagement and conversion rate. WordPress experts know which tools integrate best to provide this type of analysis, and be able to effectively apply changes to advance your website.

Ongoing care & maintenance – Do you want to perform maintenance on your vehicle yourself? Well, maybe if your a car fanatic, but if you are, pretend you’re not here. Would you want someone who specializes in working on a Kia to be working on your BMW? No. Same rule applies here. There is mandatory maintenance and software updates that are imperative to your websites health. Inexperienced web designers or those unfamiliar with WordPress can create some serious complications when trying to modify or maintain your WP site. If you consulted with a WordPress expert from the beginning, this process would be less painful. Consulting with one now can ensure smooth sailing into the future.

General business advice – Some WordPress consultants were or are business owners themselves. Furthermore, your website isn’t their first assignment. Not WordPress specific, but these people may have some experience in your industry, and be able to lend very helpful advice. Knowing how to market a business online might be something that you are not entirely in-tune with, so consulting with an expert can help guide you and add extra value to the relationship overall.

Who Needs One?

If your website is part of your business strategy, or you are an individual looking to brand yourself online – and use WordPress as a platform  – then it would be in your best interest to chat with an expert.

Not everybody needs one though. WordPress, by default, is extremely user friendly, and allows those with little knowledge to put together some quite impressive website.

WordPress Consultant Rates

The price you will pay for WordPress Consulting depends on your current state and needs – as well as your future plans for your ever-growing website. I wish I could give more info here, but there are too many variables that come into play. Some ranges I’ve seen that – in terms of a monthly retainer – prices can go anywhere from $2k up to $8k+ depending on your specific needs.

What A WordPress Consultant IS DEFINITELY NOT
  • Someone who hasn’t spent at least 48+ hours of their life reading the WordPress Codex – for reference or for fun
  • Someone who has less than 4 years of experience working hands-on with WordPress
  • Someone whose first thought for a solution is to use a plugin
  • Someone with little knowledge on how users interact with a website
  • Someone who is “afraid of code”

When speaking with a prospective WordPress Consultant, you should be able to tell if they really know what they are talking about. More importantly, check with some references to be sure they are able to walk the walk – not just suck some money out of you and leave you in desperate need of a REAL WordPress expert.

It’s powerful when a once simple blogging platform creates its own niche of business professionals. A genuine thank you to Automattic for not only bringing a cutting edge website framework, but also creating a job industry for thousands.

WordPress Host Review – Pressable

Unusually enough, I was pretty happy with old hosting company – but I had no choice.

Close to a year ago, I finally got some sense and took my websites and client sites off shared hosting and personally managed VPS setups, and put everything in the hands of a fully managed WP host. It was a hard decision at first, with the price increase and “change” involved with the enviroment that I was used to for so many years. I chose Zippykid as my host for their infrastructure and reasonable pricing. Months later, I had added 15+ sites to my account, and have referred a handful of people in the direction of Zippykid.

I loved everything about their service. It had fast load times without any effort, had the ability to have a production and staging site set up, and I could sleep at night knowing everything was backed up and secure. The only issue I started to develop was with the pricing. I had signed up for their business account that included 5 sites…but had quickly exceeded that. With many live sites, clones of sites for testing purposes, and random projects on the account, my monthly bill quickly climbed to 2-4x what I had started at.

After expressing some concern, I had the opportunity to chat with Vid Luther (their CEO) about some interesting things they had going on. He seemed genuine in wanting my feedback on a few points including the pricing. He assured me not to worry, and that soon there would be some changes made.

A month later – in deep anticipation of an “announcement” from ZippyKid, I refresh the site and see that Zippykid is no more.

Introducing Pressable

Pressable, formally known as Zippykid, is still owned and operated by the same people. They weren’t acquired, nor was there a merger with another company. Just a branding overhaul. And I mean overhaul. Its a major change, something that usually isn’t a good idea, but in this case it should work out in the long run for them. The new look is more professional, and matches the enterprise level of service and support that they offer.

In addition to the re-branding, Pressable pushed out a few other significant improvements.

Speed Monitoring & Enhancements

One thing I do love about Zippykid Pressable is their support. Like any WordPress host should (but some don’t), these guys (and gal) know their stuff, and are quick to respond and diagnose issues. Now partnered with New Relic, they have the ability to take a deeper look into performance issues with your site or the server.

They’ve had an ongoing partnership with the Google Page-speed team, and will be rolling out some really amazing things in this area very soon.

Much Improved Pricing Structure

Pressable now boasts the most impressive pricing options out there amongst the other WP hosts.

$25 – 5 sites (15k pageviews/month)
$45 – 10 sites (50k pageviews/month)
$90 – 20 sites (100k pageviews/month)
$180 – 40 sites (200k pageviews/month)
…and so on with this pattern until you break a million pageviews/month.

I am now paying more than half of what I was paying a month ago for all of the sites in my account. My price per site went from $14.00/site to $4.50/site. That makes me happy. It is a remarkable value for what you get.

All plans include at no additional cost:

  • Premium DNS
  • Akismet on every site
  • CDN fron NetDNA
  • SFPT Access
  • Malware scanning & removal
  • Automated off-site nightly backups

The Same Awesomeness As Always

Pressable is the same company that has been kicking ass for over 3 years. Nothing changed but the name…well and the improvements stated above. One thing they did get right from the start is their attention on their actual service and support team. Their focus on building the best solution for developers and publishers is what has got them to where they are today…and where they’ll be tomorrow.

Infrastructure
Hosted on a private Rackspace cloud, you’re in pretty good hands. I have external up-time tools monitoring this site and others and see very minimal downtime. The best out of the other hosts I monitor sites on – which is most.

Running NGINX with a built in batcache solution, your site will be lightning fast. No caching plugin or configuration needed. I moved a website to Pressable that was having severe slow load time issues. The homepage alone would take an average of 25s to load. After migrating the site from its old host to Pressable – and before making any optimizations – the site was loading under 4 seconds. After a few tweaks, it was under 2 seconds.

Premium DNS is provided via DYN, and is not cheap to purchase on your own. DYN is the fastest and most reliable DNS provider. You would pay close to – or over $200 a month for a similar DNS service.

Enterprise level firewalls means your site is behind a resilient barrier – a layer of protection that keeps hacks and malware to an absolute minimum.

DNS load balancing to help with traffic fluctuations or to detour attacks. I saw a client site go from 150 visits a day to an average around 7k visits a day after being featured on some major news blogs – and everything worked out well with zero issues.

Ease
The ability to add collaborators to a site makes it simple to grant temporary access or allow a team to manage a website. All the sites you own and collaborate on show up for you nicely in your admin panel. Collaborators have their own SFTP access and WP login, so everything is separate and secure.

You can clone a site with the click of a button to have another copy to test something new out, then push changes live. This is really helpful when testing out the compatibility of a new plugin, or making large changes to a live site.

Automated nightly backups sent offsite to Rackspace Cloud Files or Amazon S3. Just set it up and forget about it. Your wp-content folder and SQL database will be zipped and shipped off every day in-case something goes wrong – that’s is a good feeling.

Security
Some managed WordPress hosts charge for malware removal, Pressable certainly does not. They offer free malware scanning and removal by Sucuri. But with those firewalls and nightly backups, you shouldn’t have to worry about this to begin with.

Support
The support team at Pressable is by far the best I’ve had from a host. Ever. They are knowledgeable, responsive, and are friendly even when I ask ridiculous questions or make silly requests. Its like having an extra crew of WordPress experts on my team. Its great.

So I guess in conclusion, I didn’t actually change hosting companies, they changed on me…but for the better.

With the unveiling of Pressable, its clear these guys have big plans for the upcoming years. They have already positioned themselves in a great spot by building out their infrastructure to be superior, now with the new wave of branding – and I anticipate a more aggressive marketing strategy, they will pull themselves to a well deserved top spot in the managed WordPress hosting community.

Adding Customizable Business Info Schema in Theme

Whenever putting together a website for a business, you often have to type the businesses information out throughout the website. Whether its the phone number or company address, if something ever needs to change, it can be a nightmare to try and replace all the instances that you (or they within posts) used the info. To get around this potential issue I like to define the generic company information on the back-end, and output it via shortcodes. To make it even better, we can utilize HTML5 schema microdata to define to “bots” what this information represents.

This is only for Genesis child themes ONLY. If you are not using Genesis, then this won’t work.

Our custom Genesis admin page
This is the page that is created on the back-end for you to enter your company details. Our short-codes will pull its information from these fields, and wrap the necessary schema around it when necessary.

 

Step 1: Create The Custom Admin Menu Item & Page

First, you need to add a page to the admin area where you can change and save your information. I like to keep this big chunk of code in its own file instead of just pasting it in my main functions. It just keeps things neat and organized that way. Although it should still work out fine if you wanted to paste it in your functions file.

Below is the code that:

  • Adds our custom menu item under the Genesis admin menu
  • Creates the admin page with the fields

[php]
‘parent_slug’ => ‘genesis’,
‘page_title’ => ‘Organization Information’,
‘menu_title’ => ‘Other Settings’,
‘capability’ => ‘manage_options’,
)
);

$page_ops = array(
‘screen_icon’ => ‘users’,
);

$settings_field = CHILD_SETTINGS_FIELD;

// Default values
$default_settings = array(
‘bpmtheme_office_phone’ => ”,
‘bpmtheme_company’ => ”,
‘bpmtheme_email’ => ”,
‘bpmtheme_fax’ => ”,
‘bpmtheme_street_address’ => ”,
‘bpmtheme_city’ => ”,
‘bpmtheme_state’ => ”,
‘bpmtheme_zip’ => ”,
‘bpmtheme_description’ => ”,

);

// Create
$this->create( $page_id, $menu_ops, $page_ops, $settings_field, $default_settings );

// Init sanitization
add_action( ‘genesis_settings_sanitizer_init’, array( $this, ‘sanitization_filters’ ) );

} // End contruct

// Set up Sanitization Filters
function sanitization_filters() {

genesis_add_option_filter( ‘no_html’, $this->settings_field,
array(
‘bpmtheme_office_phone’,
‘bpmtheme_email’,
‘bpmtheme_company’,
‘bpmtheme_fax’,
‘bpmtheme_street_address’,
‘bpmtheme_city’,
‘bpmtheme_state’,
‘bpmtheme_zip’,
‘bpmtheme_description’,
) );
}

function metaboxes() {
add_meta_box(‘contact-information’, ‘Contact Info’, array( $this, ‘bpmtheme_contact_information’ ), $this->pagehook, ‘main’, ‘high’);
}

function bpmtheme_contact_information() {

echo ‘

Enter your personal information here. This will be used site-wide and create shortcodes for

‘;

echo ‘

Company Name:
‘;
echo ‘‘;
echo ‘

‘;

echo ‘

Office Phone:
‘;
echo ‘‘;
echo ‘

‘;

echo ‘

Email:
‘;
echo ‘‘;
echo ‘

‘;

echo ‘

Fax:
‘;
echo ‘‘;
echo ‘

‘;

echo ‘

Street Address:
‘;
echo ‘‘;
echo ‘

‘;

echo ‘

City:
‘;
echo ‘‘;
echo ‘

‘;

echo ‘

State:
‘;
echo ‘‘;
echo ‘

‘;

echo ‘

Zip:
‘;
echo ‘‘;
echo ‘

‘;

echo ‘

Description
‘;
echo ‘

‘;
}
}

function bpmtheme_add_child_theme_settings() {
global $_child_theme_settings;
$_child_theme_settings = new Child_Theme_Settings;
}

add_action( ‘admin_menu’, ‘bpmtheme_add_child_theme_settings’, 5 );
[/php]

Output Your Company Information – Enhanced With Schema Microdata

Next, lets create the shortcodes that will output our information. This way, you can use them throughout your theme and within your content.

[php]
function addScInfo($type) {

$phone = genesis_get_option( ‘bpmtheme_office_phone’, CHILD_SETTINGS_FIELD );
$email = genesis_get_option( ‘bpmtheme_email’, CHILD_SETTINGS_FIELD );
$fax = genesis_get_option( ‘bpmtheme_fax’, CHILD_SETTINGS_FIELD );
$street = genesis_get_option( ‘bpmtheme_street_address’, CHILD_SETTINGS_FIELD );
$city = genesis_get_option( ‘bpmtheme_city’, CHILD_SETTINGS_FIELD );
$state = genesis_get_option( ‘bpmtheme_state’, CHILD_SETTINGS_FIELD );
$zip = genesis_get_option( ‘bpmtheme_zip’, CHILD_SETTINGS_FIELD );
$companydescription = genesis_get_option( ‘bpmtheme_description’, CHILD_SETTINGS_FIELD );
$company = genesis_get_option( ‘bpmtheme_company’, CHILD_SETTINGS_FIELD );

extract(shortcode_atts(array(
‘type’ => ‘type’
), $type));

// check what type user entered
switch ($type) {
case ‘phone’:
return $phone;
break;
case ’email’:
return $email;
break;
case ‘all’:
return ‘

‘.$company.’

‘.esc_html($companydescription).’

‘.esc_html($street).’,
‘.esc_html($city).’, ‘.$state.’, ‘.esc_html($zip).’, US


Phone: ‘.esc_html($phone).’
Fax: ‘.esc_html($fax).’

‘;
break;
}
}
add_shortcode(‘info’, ‘addScInfo’);
[/php]

Usage

Use shortcodes to output the data you need – instead of manually typing the info out every time. Now if something changes, it changes everywhere.

Example:

[info type=”phone”] will output the phone number
[info type=”email”] will output the email address
[info type=”all”] will output the full company information – wrapped up nicely in schema. Search engines will appreciate and hopefully reward you.

If you want to use shortcodes in widgets, mane sure you have this filter in your functions

[php]
add_filter(‘widget_text’, ‘do_shortcode’);
[/php]

If you want to use shortcodes within a template(via php)

[php]
echo do_shortcode(‘[info type=”all”]’);
[/php]

Below is the output on the front-end when you use our new shortcodes.

Now you can use shortcodes to output pieces of information about your company. And again, if you ever need to change your phone number or address, you can simply change it in one spot and have it change site-wide. And its wrapped in schema!

Suggestions? Let me know!

Replacing Yoast SEO. Is It Worth It?

Yoast SEO has always been my goto plugin to handle on-page SEO for my WordPress sites. Yoast and team has always stayed up to date with the ever-changing world of SEO, and has provided an excellent tool to help optimize your site. With the SEO

With the recent update of Yoast SEO to 3.x, I am re-evaluating what I actually use the Yoast SEO plugin for.

Note: I am not going to compare feature-for-feature other “SEO Packs” against Yoast. There are plenty of those reviews that you can find here and here. I am looking to identify which features of this plugins I actually use, and find the least-bulky replacement. SEO has changed so much in the few years these plugins have existed, therefore the features of these plugins has shifted around to keep up with times.

It seems the Yoast team is spending majority of time and resources building out the content analysis feature – which is functionality that checks your pages content for keyword density and assigns a grade. While this is great, I simply do not use the feature. SEO has changed so much over the last few years, simply keyword stuffing your content isn’t going to get you good SEO results. I certainly agree you should use your target keyword (and/or some variation) in the url, post title, descriptions, and within the content, but you shouldn’t need a bulky plugin to remind you to do that. It is simply a best practice, and something you should be aware of in every step of your publishing process.

The fact is, Google’s algorithm is WAY smarter than this plugin could ever be in terms of keyword usage, relevancy of related keywords, the use of variations of your keyword, etc. Having the Yoast plugin light up “green” when you match some pre-defined parameters does not mean you have good SEO – and I feel it gives many users a false sense of reality when it comes to the SEO of their page/website.

Breaking Down Yoast SEO Features

Meta Titles & Descriptions
Schema.org
Webmaster Tools
Social
XML Sitemaps
Other

Meta Titles & Descriptions

  • Separator
  • Homepage, post types, taxonomies, archives, other
  • Noindex subpages of archives
  • Add noodp meta robots tag sitewide
  • Add noydir meta robots tag sitewide

Meta title and descriptions are a fundamental part of on-page SEO. This is the one feature I use extensively, and was very pleased with how Yoast SEO handled this feature. Any replacement for Yoast, in my mind, would need the ability to set default title and descriptions for pages, post types, archives, etc – with the ability to override on specific pages. This should’t be hard to find a replacement for, since it is a fairly basic feature.

Option 1:

Theme Powered
While it is debatable whether meta information should be handled be a theme or plugin, some themes do offer this feature by default.

The following frameworks/themes are equipped to handle the output of meta title/descriptions:

  • Genesis Framework

Schema.org

  • Website Name & Alternative Name
  • Company/Person Name & Logo

Yoast has done a good job at staying up to date on new features related to schema. Things like site search and sameAs can make you look good in search results and can differentiate you from competitors.

Webmaster Tools

  • Verification – Alexa, Bing, Google, Yandex

Under the General Settings for Yoast, you can find fields to help verify ownership of the website with Google, Bing, Alexa, and Yandex. These fields store the verification tags for these popular search engines and output them into your website. While it is a great idea (highly advised) to verify your website for webmaster tools, there are various ways to do this, and none require the Yoast plugin.

Option 1: Verify using alternate methods. For Google Webmaster tools, you can verify ownership by uploading an html file, via DNS, or with your Google Analytics tag. With Bing you can verify using DNS or uploading a file to the server.

Option 2: If the meta tag method is the best for you, you can easily output the meta tags into the head of your webpage yourself. You can add the code below to your themes functions.php.

Social

  • Account information
  • Facebook open graph
  • Twitter open graph
  • Pinterest open graph
  • Google open graph

XML Sitemaps

  • Custom post types

XML Sitemaps is an important feature in Yoast SEO that I do use – but mainly because the plugin includes it. Luckily, there are various plugins for this that work equally as well.

Other

  • Breadcrumbs
  • Permalinks
    • Strip the category base from permalinks
    • Remove stop words from slugs
    • Remove the ?replytocom variables
    • Enforce a trailing slash on all category and tag URL’s
  • Clean Up Head
    • Hide RSD Links
    • Hide WLW Manifest Links
    • Hide Shortlink for posts
    • Hide RSS Links
  • Canonical URLs
  • Next/Prev Links
  • No-index Posts/Pages
  • 301 Redirects (I believe this feature was removed from the free version and is now a premium feature )

Rolling back Yoast to previous versions

While it is generally not advised to use out-dated versions of plugins, I have rolled back to 2.5.3 on many production sites I manage. I am keeping a very close eye out for security releases, and if a vulnerability opens up with the version of WP SEO I am using, I will not heasitate
What am I missing? Any other features that Yoast SEO offers that make it hard to transition away from?

Automatically Add Google Analytics Event Tracking With jQuery

Automatically add basic Google Analytics event tracking using jQuery. I wrote it for use on this site, but the script can be used as is or modified to suite your needs.

You can either:

  1. Add the code to an existing theme JavaScript file that is called on every page (or the pages you want to track events)
  2. Add the code to the footer of the every page before the closing body tag () (or the pages you want to track events)
  3. Download the script and include it on every page (..and again – or the pages you want to track events)

That’s it!

Then clicks will be automatically trigger a Google Analytics event on:

Other Outbound Links – Any other link that leaves your domain, but is not caught by the social media or affiliate match.

Outbound Affiliate Links – set as any link within your domain that includes “/go/”. You can alter to your liking by adjusting the match in the affilateLink variable. [code type=”js”]var affiliateLink = new RegExp(‘/go/+’);[/code]

Outbound Social Media Links – set as any outbound link that includes “Facebook, Twitter, Google+, Linkedin and Twitter”. You can change or adding or removing the names in the socialMedia variable. Make sure you seperate the values you want to match with a pipe “|” sign, and add them before the plus “+”. Case matters. [code type=”js”]var socialMedia = new RegExp(‘plus|linkedin|pinterest|facebook|twitter+’);[/code]

PDF Download Links – Any link that end in .pdf.
ZIP Download Links – Any link that ends in .zip
Anchor Text Links A link within your domain that includes a “#” sign, or a relative anchor link.

Any thoughts, feedback, or fixes would be appreciated.

Disclaimer: No guarantee! but it does work, I actively use both variations on sites

[code type=”js”]
jQuery(window).on(‘load’, function(){

var myWebsite = new RegExp(location.host);
var myWebsiteAnchor = new RegExp(‘#+’);
var badlinkJs = new RegExp(‘^javascript:+’);
var socialMedia = new RegExp(‘plus|linkedin|pinterest|facebook|twitter+’);
var affiliateLink = new RegExp(‘/go/+’);
var isDownloadPdf = new RegExp(‘.pdf$’);
var isDownloadzip = new RegExp(‘.zip$’);

jQuery(‘a’).each(function(){

var url = jQuery(this).attr(“href”);

if (badlinkJs.test(url)){
}
else if (affiliateLink.test(url)){
jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Outbound’, ‘Affiliate’, ‘”+ url +”‘]);”);
}
else if (socialMedia.test(url)){
jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Outbound’, ‘Social Media’, ‘”+ url +”‘]);”);
}
else if (myWebsiteAnchor.test(url)){
jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Anchor’, ‘Click’, ‘”+ url +”‘]);”);
}
else if (! myWebsite.test(url)){
jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Outbound’, ‘Other’, ‘”+ url +”‘]);”);
}
else if (isDownloadzip.test(url)){
jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Download’, ‘Zip’, ‘”+ url +”‘]);”);
}
else if (isDownloadPdf.test(url)){
jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Download’, ‘Pdf’, ‘”+ url +”‘]);”);
}
else { }

}); //End each function

}); //End window load function
[/code]

If you are using Google Analytics Universal, the code will be slightly different.

View below for UA event tracking
[code type=”js”]
jQuery(window).on(‘load’, function(){

var myWebsite = new RegExp(location.host);
var myWebsiteAnchor = new RegExp(‘#+’);
var badlinkJs = new RegExp(‘^javascript:+’);
var socialMedia = new RegExp(‘plus|linkedin|pinterest|facebook|twitter+’);
var affiliateLink = new RegExp(‘/go/+’);
var isDownloadPdf = new RegExp(‘.pdf$’);
var isDownloadzip = new RegExp(‘.zip$’);

jQuery(‘a’).each(function(){

var url = jQuery(this).attr(“href”);

if (badlinkJs.test(url)){
}
else if (affiliateLink.test(url)){
jQuery(this).attr(“onclick”,”ga(‘send’, ‘event’, ‘outbound’, ‘affiliate’, ‘”+ url +”‘]);”);
}
else if (socialMedia.test(url)){
jQuery(this).attr(“onclick”,”ga(‘send’, ‘event’, ‘outbound’, ‘social media’, ‘”+ url +”‘]);”);
}
else if (myWebsiteAnchor.test(url)){
jQuery(this).attr(“onclick”,”ga(‘send’, ‘event’, ‘anchor’, ‘click’, ‘”+ url +”‘]);”);
}
else if (! myWebsite.test(url)){
jQuery(this).attr(“onclick”,”ga(‘send’, ‘event’, ‘outbound’, ‘other’, ‘”+ url +”‘]);”);
}
else if (isDownloadzip.test(url)){
jQuery(this).attr(“onclick”,”ga(‘send’, ‘event’, ‘download’, ‘zip’, ‘”+url +”‘]);”);
}
else if (isDownloadPdf.test(url)){
jQuery(this).attr(“onclick”,”ga(‘send’, ‘event’, ‘download’, ‘pdf’, ‘”+ url +”‘]);”);
}
else { }

}); //End each function

}); //End window load function
[/code]

Or the compressed version:
[code type=”js”]
jQuery(window).on(“load”,function(){var d=new RegExp(location.host);var b=new RegExp(“#+”);var a=new RegExp(“^javascript:+”);var g=new RegExp(“plus|linkedin|pinterest|facebook|twitter+”);var e=new RegExp(“/go/+”);var c=new RegExp(“.pdf$”);var f=new RegExp(“.zip$”);jQuery(“a”).each(function(){var h=jQuery(this).attr(“href”);if(a.test(h)){}else{if(e.test(h)){jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Outbound’, ‘Affiliate’, ‘”+h+”‘]);”)}else{if(g.test(h)){jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Outbound’, ‘Social Media’, ‘”+h+”‘]);”)}else{if(b.test(h)){jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Anchor’, ‘Click’, ‘”+h+”‘]);”)}else{if(!d.test(h)){jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Outbound’, ‘Other’, ‘”+h+”‘]);”)}else{if(f.test(h)){jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Download’, ‘Zip’, ‘”+h+”‘]);”)}else{if(c.test(h)){jQuery(this).attr(“onclick”,”_gaq.push([‘_trackEvent’, ‘Download’, ‘Pdf’, ‘”+h+”‘]);”)}else{}}}}}}}})});
[/code]

Any thoughts? Anything you would change or add? Please let me know!

Marcus Hiles Wistia Shortcodes

marcus hiles wistia shortcodes banner

I’ve finally published my first plugin on WordPress.org! The plugin is called Marcus Hiles Wistia Shortcodes – and it gives people an easy way to add Wistia videos to their WordPress site using shortcodes.

You may be wondering why use shortcodes when you can just grab the embed code from within Wistia. The reason I created this plugin is to solve a few issues I was having with Wistia videos on my clients WordPress sites.

  • The editor would sometimes strip out the javascript files required to make the videos work
  • The editor would sometimes strip off the attributes on html wrappers that were required to make the videos work
  • We would often end up loading the wistia.js multiple times on a page if there was more than one video per page
  • We wanted a way to intelligently load all the scripts required by Wistia to make the videos work
  • Wistia has changed the embed code here and there, and we wanted consistency on how embeds were handled.

The Editor Breaks Wistia Embeds Sometimes

The content editor in WordPress does not like javascript, or non-standard html attributes. Whenever you save content, or switch back and forth between the visual and text editor, WP sanitizes the content. Unfortunately, this can remove things that you wanted there. To combat this, our first idea was to use a shortcode in-place of Wistia embeds. That way, the shortcode would act as a placeholder, where we could then – in code – inject the video in the right place.

Intelligently Loading Javascript

The embed code you copy from Wistia always includes the main wistia.js file. If you are copying multiple embed codes onto the same page, this leads to including this file multiple times within the page. Additionally, I’m not really a fan of having script tags randomly throughout the body of my document. It seems `hacky` and brittle. To resolve this, we use native WordPress functions like `wp_enqueue_scripts` and `wp_is_enqueued` to detect if the primary wistia js has loaded, and to load it only once, and also to group all the specific video .json files together right before the closing body tag.