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!
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.
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
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.
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!
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”
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):
Every year I publish my list of resolutions as well as a scorecard from the previous year. For 2015, I’ve redesign the site (well, I used HTML5 Boilerplate) and broke my resolutions down into 2 categories: “Do More” and “Do Less.”
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.