Writing

Function Friday #14: include website documentation within the admin area

When a project’s deliverables include a how-to manual, it’s often done as a PDF that’s totally separate from the website. I started including the documentation I write in the same place that people will be working on the website: within the admin area itself. This way it never gets lost as a result of staff turnover or file purges.

Continue reading “Function Friday #14: include website documentation within the admin area”

Function Friday #12: include code in your content with a custom shortcode

For a variety of reasons, WordPress will strip out a lot of code you may want to paste into the editor (even if you’re on the Text tab). If the code you’re pasting has lots of line breaks to improve readability, WordPress will also convert line breaks to br and p tags.

Continue reading “Function Friday #12: include code in your content with a custom shortcode”

Function Friday #11: displaying menu item descriptions with a custom walker

Have you ever wondered about the “Description” field on the Appearance → Menus page, with its notice that “The description will be displayed in the menu if the current theme supports it”? I’d seen it before (when enabling the “CSS Classes” field via Screen Options) but hadn’t paid much attention to it, until I had a client that wanted some text to appear next to each item in the navigation menu.

Continue reading “Function Friday #11: displaying menu item descriptions with a custom walker”

Function Friday #9: create a custom widget to list blog contributors

A fairly common request I get is to have a list of my client’s blog contributors in the sidebar. It’s odd this isn’t one of the default WordPress widgets, to be honest! But it’s easy to add with a bit of code. You can also further customize the widget using the plugin Advanced Custom Fields.

Continue reading “Function Friday #9: create a custom widget to list blog contributors”

Function Friday #8: add the blog page slug to single post permalinks

If a site is using WordPress posts for non-time-sensitive content (like this one), I’ll often remove the date from the permalinks. On a site that’s using a Posts Page I’ll also add the slug from the Posts Page into the URL of all posts, plus all category and tag archives. It’s a small detail that makes finding your way around the site just a little bit easier.

Continue reading “Function Friday #8: add the blog page slug to single post permalinks”

Function Friday #7: send empty searches to the search results page

One of the things I test on every site I build is to run a search, and one time I accidentally did it with an empty search form – just hit enter without filling in any keywords. To my surprise I was redirected to a page that showed the latest blog posts instead of the search results page I expected.

Continue reading “Function Friday #7: send empty searches to the search results page”

Function Friday #6: add a class to the current content’s ancestor in the menu

Sometimes a tiny design change can make navigating a website much easier. Indicating which page you’re currently on by changing the style of the corresponding menu item is one of those changes, and WordPress helps you out by adding a bunch of classes to every menu item – but not once you add custom post types into the mix.

Continue reading “Function Friday #6: add a class to the current content’s ancestor in the menu”

Function Friday #5: show custom image sizes in the attachment display settings

I often find the default image sizes generated by WordPress (Thumbnail, Medium, and Large) aren’t sufficient to cover every situation where I want to use images of a specific size. And once you’ve set up a bunch of custom image sizes, you might want to insert them into your posts and pages, not just use them in your theme code.

Continue reading “Function Friday #5: show custom image sizes in the attachment display settings”

I write about code, client resources, and nerdy things I like. You can jump straight to the technical stuff or the nontechnical stuff, or find specific topics below.