Steve Grunwell

Open-source contributor, speaker, and electronics tinkerer

Tag: Theme

A pile of LEGO bricks spread out across a hardwood floor

Understanding the functions.php file in WordPress

If you’re just getting started with WordPress, there’s likely a lot of new terminology being thrown at you. Beyond fundamentals like “themes” and “plugins”, you’re probably seeing “actions”, “filters”, and a ton of code snippets with instructions like “just add this snippet to your functions.php file.”

Let’s take a step back and look at WordPress’ functions.php file; what it is, where it lives, and how it works. Once we understand those points, we’ll learn how to add snippets to our WordPress sites without having them accidentally overwritten.

Continue reading→

A photo of a mountain with increasingly smaller copies of the same image overlaid on top.

Automatically Set WordPress Thumbnail Sizes When Switching Themes

Right now, one of my main projects at work is a totally new theme for the official news outlet for a major corporation. Along with a million other changes, one thing that needs to happen ASAP after switching to the new theme is that the image thumbnail sizes – controlled through Settings › Media in wp-admin – need to be changed.

Of course, being the lazy, automation-obsessed developer that I am, I wanted to find a way to automatically set these thumbnail sizes the instant we changed themes. Fortunately, where there’s a hook, there’s a way to make this happen automatically.

Continue reading→

Quick Tip: is_login_page() Function for WordPress

When building WordPress themes, I typically try to keep as much code as possible out of the head section of my template and instead rely on the wp_head() action hook. By putting all of my wp_register_script() and wp_register_style() calls in one function I have a single place to manage (theme) assets and their dependencies. At the bottom of the function I usually like to enqueue my global scripts and styles (ones that will always be present) but am careful to keep them from appearing in the WordPress administration area.

Continue reading→

Be excellent to each other.