How To Make Bootstrap Dropdown Menus Expand on Hover

Bootstrap is one of the most popular, if not the most popular, front-end responsive HTML/CSS/JS frameworks for developing responsive websites. It’s incredibly easy to use and has a huge community behind it so there’s no shortage of documentation, code snippets, and tutorials floating around online.

I am full of praise for Bootstrap but I do have one gripe: the dropdown menus simply don’t function the way I’d like.

Normally, when interacting with a dropdown menu item, I would expect it to expand when you hover the menu item with your mouse. The creators of Bootstrap made a conscious design decision and instead require a click for the menu to expand. Not only that, when browsing on a touch device such as an iPad, once you do click to expand a dropdown, there’s no way to close it without clicking a link somewhere on the page which would likely be perceived an as annoying glitch from a user perspective.

Here’s a little jQuery snippet that solves both of these problems in one shot and will allow your visitors to:

  1. Expand the dropdown with a mouse hover.
  2. Close an expanded dropdown by clicking anywhere on the page, on touch devices.
// Mouseover Toggle for Bootstrap Nav Menu
$(document).ready(function() {
  $('.dropdown').hover(function(){ 
    $('.dropdown-toggle', this).trigger('click'); 
  });
});

If you also find the default Bootstrap dropdown behavior doesn’t quite function the way you’d like, this simple little snippet should solve that problem for you.

6 Essential WordPress Plugins That Everyone Should Install

One of the beautiful aspects of using a popular Content Management System like WordPress is that there is so much extra functionality that can be plugged right into your website with free plugins that are created by members of the WordPress development community. Having access to the huge library of WordPress plugins means that whenever you’re looking for a new feature for your WordPress site, instead of needing to have custom programming done, a plugin likely already exists for it and can be installed with a few clicks.

Here is a list of plugins that we install on every single one of our installations. There are often a handful more but these are part of our checklist when setting up a WordPress installation.

1. Advanced Automatic Updates

One of the most important, but often overlooked, aspects of your online presence is ensuring that your website is protected from malicious attacks and intrusions. As popular as WordPress has become, that same popularity is also a weakness from a security perspective. If you are running an outdated WordPress installation, plugin, or theme with a known vulnerability, it won’t take long for hackers to find sites with these security holes and exploit them. In order to protect yourself, it is an absolute must to keep all aspects of your WordPress installation up to date. If you don’t log in to your site all the time, it can be easy to fall behind on your updates.

We’re all about automation so instead of relying doing updates manually, you can install the Advanced Automatic Updates plugin. It will ensure that core security updates are automatically applied as well as automatic updating of plugins and themes. A time-saving plugin that will also keep your WordPress site safe.

2. iThemes Security

Continuing on our security angle, the next must-have plugin in our list is element in your line of defense for securing your WordPress installation. Formerly known as Better WP Security, iThemes Security is the #1 rated security plugin with over 2000 5-star reviews at the WordPress Plugin Directory. It has 30+ methods to protect your site from attacks. It works in several different ways such as obscuring certain public details about your installation to prevent attackers from learning too much about your site. The plugin also regularly scans your entire installation for vulnerabilities and will patch them immediately. There is also the brute force protection which means that it will block anyone who is repeatedly trying to log in to the admin with the wrong credentials. Too many features to list.

It is highly configurable with granular control of settings but for those who aren’t as tech savvy or patient can simply use its “one click” activation to automatically enable the majority of it’s features.

3. Broken Link Checker

One thing you want to avoid is having broken links on your site. If a visitor is browsing your site and clicks an external link that leads to a website or page that no longer exists, it’s a pretty unpleasant user experience. The visitor will likely doubt the authority of your site and wonder if they can really trust a website with  broken links. Staying on top of external links on your site is a tedious task, especially once you have a lot of content. Like we said before, we’re huge fans of automation and this plugin will automatically do the work for you.

Broken Link Checker will scan all your content on a regular basis and provide you with a dashboard of all the links that need fixing, with optional email alerts. The plugin is also able to check for broken images and video content such as YouTube and Vimeo as well.

4. WordPress SEO by Yoast

Every website owner understands the power of ranking well in Google. We all want to rank at the top of the Google search results for our relevant keywords. There are reportedly over 200 signals that Google’s algorithm uses in order to determine rankings.  WordPress is already pretty good for SEO right out of the box but it can still be improved. This plugin, WordPress SEO by Yoast, right after installation, will guide you through some basic settings that are recommended to be changed within the WordPress admin dashboard. Furthermore, when writing content, you will have a new panel under the post that helps guide you to writing content that will rank better.

WordPress SEO also takes care of all the technical optimization elements such as certain meta and link elements as well as creating an XML sitemap for search engines.

5. Google Analytics by Yoast

Google Analytics is a service offered by Google that allows you to track the activity on your website such as how many visitor’s you’re getting daily and where they’re coming from. Installation is a breeze and allows you to add Analytics to your site without having to mess with the source code.

Once installed, you’ll be able to view traffic stats right from your dashboard. The plugin also has the useful option to track outbound clinks and downloads.

6. UpdraftPlus

Now that your WordPress installation is secure, without any broken links, and optimized for search engines, the last and most critical step is to install a plugin to manage your backups. Trust me, stuff happens. Your site can be wiped out in many disastrous scenarios. Backups have saved us several times and you will thank yourself later for preparing for the worst.

UpdraftPlus makes backups easy. We usually configure it to backup the entire site on a daily or weekly basis and automatically upload it to a remote cloud storage provider such as Dropbox.

That wraps up our collection of must-have WordPress plugin. We hope it helps.

10 Step Guide To Moving From Blogger (Blogspot) to WordPress with a 301

Moving from blogspot.com subdomain hosted with Blogger and want to make the upgrade to your own server with WordPress?  I had to do this for a client and had a lot of trouble finding a guide to do this in a way that would definitely preserve SEO.

Using this blogger to wordpress migration guide, Google will re-index your site using your new top-level domain, all your old posts/pages will be re-indexed, and anyone visiting your old posts or website will be redirected to the new corresponding location.  Sounds to good to be true?

In this guide we will use 301s to redirect from blogspot to your new domain as that’s only way to be sure that Google and other search engines will index your website’s new location.

1. First things first, we need to set up our top-level domain as a Blogger custom domain. To do this, you need to modify your new domain’s DNS to point to the Blogger service.  Once the DNS is set up, you simply add your custom domain to your blogger domain settings.  Here are the detailed instructions on how to add a custom domain to blogger.

The good news: When people visit your old site, people will be redirected to the new custom domain.  Even old posts/pages will redirect to the correct locations.

The really good news: Blogger adds a 301 redirect on your old blogspot subdomain so that Google and other SE will know that your site has permanently moved.  This means that Google will start replacing old links in their database with the new pretty TLD links.  (Example: mywebsite.blogger.com/hello-everyone.html will be indexed as mywebsite.com/hello-everyone.html)

2.  The waiting game. It can take a few hours to a few weeks for Google to re-index the correct links. It’s important that we wait until the new links are indexed before moving to the new server or our WordPress installation.

3.  Set up the custom domain and install WordPress on your server. Remember, we are not changing DNS yet so people will still see the custom domain hosted at blogger until we are fully migrated to WordPress and ready to pull the trigger.  For working on this domain while it’s still on your server you’ll need to modify your hosts file.  Once your hosts file has been modified to point your TLD to your server, and you’re closed and re-opened your browser, you’re ready to install WordPress.  Go ahead, install WordPress on your domain.

4. Use the WordPress migrate tool to import all your posts and comments. You can find the migration tool via Tools -> Import -> Blogger and then follow the provided instructions.

5.  Permalink settings. You’ll want to change the WordPress permalink settings to match the Blogger structure (can be changed later, but for now you’ll need to keep them) which is “/%year%/%monthnum%/%postname%.html“.

Another roadblock is that blogger cuts off long URLs and also removes common words from it’s permalinks.  WordPress does not.  That means that some of our old redirected links wouldn’t find their destination on the WordPress version of our site as the links wouldn’t match.  Have no fear, there’s a plugin that does the job of making WordPress slugs match their blogger counterparts.  Special thanks to Justin for this useful plugin –>  Plugin to preserve blogger links when moving to WordPress.  Follow steps 1 – 6 on that page for instructions.

6. Set up redirects via .htaccess. You’ll need to redirect your old category pages to link to the new WordPress category permalinks.

7.  Links in your sidebar. Add any hardlinks you had on your blogger installation to the WordPress blogroll as these weren’t migrated over.

8. Design. Find a custom WordPress theme to install so you can have a nice design vs. the default WordPress theme.  Tons of options out there.

9. Revert hosts file. Change your hosts file back to normal, removing any entries you made for the custom domain.

10.  Pull the trigger and change DNS. Once you’re links in search engines have been updates, thanks to the 301 we set up, we are now ready to make the big change.  The last change is to point your DNS to your own server, away from Blogger.  This may take anywhere from a few minutes to a few hours to take effect, but eventually when you access your site again, you’ll see your website on your host using WordPress as it’s CMS.

11.  Last step, redirects for links pointing to your old address. After changing DNS to your own server, the 301 that Blogger provides will cease to work.  This means that any links pointing to your old blogspot address won’t redirect anymore.  To fix this important issue, use a JavaScript redirect on your old blogger site to prevent breaking any links that still point to your old address. Justin has provided a JavaScript snippet that does exactly that.  You can find that snippet for JavaScript to redirect from your old blogspot URLs here.

OK, it’s now officially an eleven step guide. 🙂

Congratulation, you’ve just migrated from Blogger to your own server running WordPress!

Speed Up WordPress Performance

For low traffic usage, WordPress performs fine and you may not notice that it can be quite heavy on server resources. However, if you do get more traffic than a few visits a day, then there is an essential plugin to speed up WordPress by using a method called ‘caching‘.

Normally, everytime a visitor comes to your site, WordPress connects to your database several times to output your posts and comments. What this caching plugin will do is save static versions of your pages once per hour and show that page to visitors instead of generating the pages from scratch for every single visitor.

I installed the plugin, wp-supercache, on several medium sized sites, and saw a HUGE decrease in server resources being used. Your server and host will love you for not using up resources and your visitors will love you for having a really fast responsive site.

Download and Install wp-supercache today!

Thumbnail For Your WordPress 2.5 Posts

For a recent project of mine, I wanted my WordPress site to have posts listed on the front page, but wanted the option to include a unique thumbnail for each post that would sit pretty under the title.

I came across a nice tutorial after a little Google searching and found this great article on exactly how to do it.

It’s absolutely perfect, just that once you do this, all your posts need to have a thumbnail, otherwise there will be a missing placeholder where the thumb should be. In my case I wanted to have the ability to either use the feature or not to use it.

From using the foundation of Blogging Bits’ code, I just added a statement to check if the image has been added assigned to the post, and if not, the thumbnail code is ignored. If this is something you want to do, check out Blogging Bit’s tutorial, and if you want to add my modification for the option not to always need a thumb, here it is:

<?php
$thumb = get_post_meta($post->ID, "thumb", true);

if ($thumb != "")
{ ?>

<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<img src="<?php $values = get_post_custom_values("thumb"); echo 
$values[0]; ?>" alt="<?php the_title(); ?>" class="thumb" />
</a>

<?php the_excerpt(); ?>
<?php } else { ?>
<?php the_content(); ?>
<?php } ?>

 
Remember, I’m not a professional PHP programmer myself but I’ve tested the code and it seems to work. Good luck, I hope it helps!