Growth Hacking WordPress Plugin from Qunb

I’ve been using qunb for quite a while. They generate what they call datastories for your sites using Google Analytics data. The datastories include data like number of visitors, top countries, and most viewed pages. They do a really nice job of presenting your analytics data in a more human readable fashion, a good birds-eye view of it all.

I got an email from qunb announcing the release of their WordPress plugin, Growth Hacking Analytics by qunb.com. It’s available in the WordPress plugin directory.

After installing the plugin, you’ll need to authorize it to use your Google Analytics account. You can also connect your Facebook page and Twitter account, but those don’t require any special permissions.

Qunb has also setup a Google Group that will host discussions about bugs and ideas for improvements. As of this post, however, the Google Group gives me a page titled “Authorization Failed“, with a message stating “Please sign in with an authorized account to view this content“.

The WordPress plugin will add a new sub-menu to the main Dashboard menu. It has 4 main parts to it. The first shows stats about visitors or pageviews, you can select which you want to view. The second part shows pageview stats on the most recent post. The third part, titled Tops of the day, lists your top posts, best social network in terms of referrals, and the best non-social referrer. The fourth and last part displays the growth comparison compared to the last week. You can also view growth comparison for the last month, but you’ll need to have a paid qunb account for that.

The starter plan is $5/month and includes unlimited datastories, and there’s no limit on the number of websites you track.

0

How-To: Reset WordPress Database to Default Settings

Easily Reset WordPress Database

WordPress Database Reset is a WordPress plugin I recently came across that will at some point prove very, very useful to me.

It’s not often that I need to reset a production WordPress database to it’s default settings, but this plugin will make the task a whole lot easier. Chris Berthe, the author, describes the plugin like this:

WordPress Database Reset is a secure and easy way to reinitialize your WordPress database back to its default settings without actually having to reinstall WordPress yourself.

I can see this being crazy useful for WordPress plugin and theme developers. We frequently need a fresh database to work with, so I’ll be adopting this plugin in my WordPress plugin and theme development workflow from here on.

WordPress Database Reset requires WordPress 3.0+ and can be installed just like any other WordPress plugin. It’s in the WordPress Plugin directory, and can also be found on GitHub.

It even integrates with WP-CLI, a command line tool for interacting with WordPress. This allows you to do things like select which tables you want to reset:

wp reset database --tables='users, posts, comments, options'

Here’s a list of features:

  • Extremely fast one click process to reset the WordPress database
  • Choose to reset the entire database or specific database tables
  • Secure and super simple to use
  • Prefer the command line? Reset the database in one command
  • Excellent for theme and plugin developers who need to clean the database of any unnecessary content quickly

If you’re a WordPress theme or plugin developer, you should definitely check it out.

0

How-To: Add Minimal-UI Viewport Meta Tag to WordPress

Introduced with iOS 7.1

I don’t have an iPhone, but my daughter does have an iPad Mini, which is running the latest iOS, 7.1. However, this only works for those of you on iPhone’s, so I see no difference.

Martin Wolf was kind enough to let me use the image from his post about this subject so that I could more easily illustrate the difference. So, even if you don’t have an iPhone, you can still see the changes this makes in the featured image above.

With the release of iOS 7.1 (and possibly late 7.0.x builds), Safari introduced support for a new value in the viewport meta tag. To me, it sounds like it adds effects similar to how Chrome hides its top bar when a page is loaded, but more. For example, the navigation buttons at the bottom are hidden.

I rarely use Safari, like never. Chrome is available on iOS, so that’s what I’ve always used. That’s not to say that you shouldn’t support Safari to it’s fullest, because I’d wager that a majority of iOS users stick with the default, which is Safari.

Chances are, your theme already has a viewport meta tag defined in it’s header.php file. If it does, add minimal-ui to it, so it should look something like this:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimal-ui" />

If your theme doesn’t already have a viewport meta tag set, you can add one with your functionality plugin or theme’s functions.php file like so:

<?php
function set_viewport() {
?>
<meta name="viewport" content="width=device-width, minimal-ui">
<?php
}
add_action('wp_head', 'set_viewport');
?>

Adding the code above will add a brand new viewport meta tag for you, so only use that if your theme isn’t already using a viewport meta tag in it’s header.php file.

That’s it!

0

WordPress: Sending Correct HTTP Status Code on Login Failure

For some reason, WordPress will send a 200 HTTP response status code, or OK, when a login attempt has failed. Why not send a 403 status code, which is designed specifically to say you can’t be here, or forbidden, actually. There’s even a better alternative to 403, but stay with me.

I came about this bit of information while reading this post by Konstantin Kovshenin. And was able to confirm it myself by logging into this site incorrectly, as you can see in the featured image above. wp-login.php is returned as 200 OK and is circled in red.

So, as Konstantin suggested, we can use this code to send a proper 403 Forbidden status code on a failed login attempt:

<?php
function my_login_failed_403() {
    status_header( 403 );
}
add_action( 'wp_login_failed', 'my_login_failed_403' )
?>

But why send a 403, which is Forbidden? It’s not truly a forbidden page, as people have a legit reason to be there, even if they can’t remember their password.

So, sending 401 Unauthorized as the HTTP response status code may be even better.

<?php
function my_login_failed_401() {
    status_header( 401 );
}
add_action( 'wp_login_failed', 'my_login_failed_401' );
?>

So, you can use either of those, the first chunk to send a 403 Forbidden response, and the second for sending a 401 Unauthorized response code.

On login failure, send "401 Unauthorized" or "403 Forbidden" HTTP response code?

View Results

Loading ... Loading ...

Either could go in the functions.php file for your theme, or more likely, in your WordPress functionality plugin.

You can find a good list of HTTP response codes at the Mozilla Developer Network site.

0

WordPress Plugin: Thumbnail Viewer 1.2

I’ve released version 1.2 of the Thumbnail Viewer plugin for WordPress (actually released like 2 weeks ago, just now announcing). Not many changes were made in 1.2 except the fixed paths to the css and javascript files. The incorrect paths totally prevented the 1.1 from working for people who downloaded from the WordPress Plugin Directory.

Go Download Thumbnail Viewer Plugin 1.2

Shortly after the release of 1.1, I started hosting thumbnail viewer at the WordPress.org Plugin Directory. Hosting there gives me access to a Subversion repository, which I had never used before. Hosting at the WordPress Plugin Directory gives the plugin greater exposure and provides me with a central place to store all the code.

Version 1.2 was prompted when I started getting a bunch of people contacting me saying the plugin was not working. I got right down to it and realized the plugin was looking in the wrong directory for thumbnailviewer.css and thumbnailviewer.js. I renamed some directories before moving the project to the WordPress Plugin Directory and forgot to update the directory names in the PHP code.

So, version 1.2 was basically just a fix for the incorrect directory names. Until I can get a dedicated page setup here for thumbnail viewer, please see the announcement post for version 1.1 for installation directions and examples. There’s also some pretty helpful comments in there.

Go Download Thumbnail Viewer Plugin 1.2

If you’re still running version 1.1, there’s nothing your missing in 1.2. However, the directory format in 1.2 is how it’s gonna be from now on, so you might as well upgrade. You can download from the WordPress Plugin Directory. The latest, most up-to-date version will always be on that page.

UPDATE: Finally!!! I’ve taken the time to create an official page for my Thumbnail Viewer plugin. Please try to keep all the support related questions centered on that page. The announcement post for version 1.1 still has some pretty helpful comments though, I may decide to move them to the new page at some point.

0