Deleting 3 Million Spam Comments from a WordPress Database

Posted on

Over at the Crowd Favorite blog, I wrote up a post about an interesting problem I solved recently. I laid out everything you need to know there, but it involves downloading a HUGE database and putting WP-CLI to good use. If you haven’t used it before and you do development with WordPress, it’s super valuable. Anyway, check out the post – it’s a good one!

Deleting 3 Million Spam Comments from Your WordPress Database

WordPress Helper Functions for Detecting IE

Posted on

The other day I was working on a problem where I wanted to check if a website was using a specific browser (in this case IE) and version (in this case 9 or below). I came up with 2 functions that would serve an a nice, reusable check for both. These can also be extended to check for other browsers or versions, or even accept custom regular expressions.

Continue reading “WordPress Helper Functions for Detecting IE”

Add IE Conditionals to wp_enqueue_style

Posted on

When creating a WordPress theme, it’s best practice to use wp_enqueue_style for adding all stylesheets, including style.css. At first glance, this can pose a challenge if you want to conditionally include CSS based on the browser (like IE-only styles, for example). Luckily, there is a quick way to do this in WordPress using $wp-styles:

global $wp_styles;
wp_enqueue_style( 'jlc_ie_styles',get_template_directory_uri() . 'css/ie-style.css', array(), '1.0.0' );
$wp_styles->add_data( 'jlc_ie_styles', 'conditional', 'IE' );

The code above calls on the $wp-styles class to associate our IE-only stylesheet (by tag/name/slug) with a condition, the condition being “IE.” If you wanted IE 9 and below, you could do this:

$wp_styles->add_data( 'jlc_ie_styles', 'conditional', 'lte IE 9' );

This is a great (and best practice) way to conditionally call styles. You can see more examples with comments over in this gist by wpscholar.

Make wp-caption the same (responsive) width as the Image

Posted on

I was working on a problem last week in WordPress where the caption for an image was extending the whole width of the container, not staying the width of the image. This make sense – the image is inside the .wp-caption container. So how to we fix it? Let me tell you!

Continue reading “Make wp-caption the same (responsive) width as the Image”

Mobile Matters! Google to change Search Rankings

Posted on

If you’ve done a Google Search on your mobile device recently, you may have noticed that Google adds a bit of text in the search results alerting you to the fact that a website is (or is not) mobile friendly. This can have a big impact on your website’s search ranking.
Continue reading “Mobile Matters! Google to change Search Rankings”

Fix wp_nav_menu on Custom Type Archives in WordPress

Posted on

Recently I was working with an issue in WordPress where the site’s menu was not showing up on an archive page for one of my custom post types. There were a few troubleshooting things I tried, including the most common recommendation, use theme_location instead of menu when referencing the menu in your theme (code after the jump):

Continue reading “Fix wp_nav_menu on Custom Type Archives in WordPress”

A Commitment to Committing

Posted on

If I can say one thing about working at Crowd Favorite, it’s that I’ve learned a lot about git and Github. From using the basic command line tools to working closely with submodules, I can say I understand git much more today than I did 3 months ago. Earlier this week, my friend Colin challenged me to 30 weekdays of committing to projects on Github. Starting today, I will take him up on that.

Continue reading “A Commitment to Committing”