functions.php

Use latest jQuery from CDN in WordPress

WordPress is shipped with a current jQuery version by default. When you update your WordPress core and there’s a new version of the jQuery library that is used in the package, it will be updated, too. But you might have reasons not to update your WordPress core, want to use an outdated version of jQuery, or use the jQuery library hosted on a content distribution network (CDN). Google is hosting jQuery and other libraries publicly that you could use and include in your WordPress theme.

« Read more about: Use latest jQuery from CDN in WordPress  »

Shared functions.php across WordPress multi-sites

Ever wondered how you could use a shared functions.php in a WordPress multisite (WPMU) environment? If you are using a WordPress multisite setup you’ve probably come across using the same custom WordPress functions over and over again. As a theme developer, you might already have created a functions.php blueprint that you will use in every new theme. In this article, I will show you how to set up and implement a shared functions.php that you are be able to use across a WordPress multisite installation.

« Read more about: Shared functions.php across WordPress multi-sites  »

Make your WordPress gallery link to a custom image size

Using the WordPress gallery shortcode and linking the gallery items to its media source, WordPress will always create a link to the full size image. For a project I needed to change this behaviour since the full size images uploaded by editors will usually be too large to be dealt with the way we want to.

We will be using galleries linking to large size images and displaying them in a fancybox.

« Read more about: Make your WordPress gallery link to a custom image size  »

Content snippet in blog posts with a shortcode

You’re having the same content snippet on multiple WordPress blog posts and are fed up with making changes to that small piece on each single post? I’m showing you how to create a custom WordPress shortcode that pulls the content from a single post and injects it right into your blog posts.

The situation

I used an ad managing plugin for displaying the same content in multiple articles. Basically, those are a series of blog posts that had a table of contents.

« Read more about: Content snippet in blog posts with a shortcode  »

Using the first image in a WordPress post as featured image

I am a hobby photographer and I like to show and share my “work”. WordPress introduced the “featured image”-feature in version 2.9 (as “post thumbnail“) which is fine for displaying an image that is somehow hooked to an article or blog post, or even a page.

Post Thumbnail, now Featured Image, is an image that is chosen as the representative image for Posts, Pages or Custom Post Types. The display of this image is up to the theme.

« Read more about: Using the first image in a WordPress post as featured image  »

Hide a single category in WordPress

Recently, I was skimming through the WordPress Plugin Directory. I was looking for a plugin to hide a single category in WordPress, but doesn’t hide its posts. That plugin should only the category from the category listing beneath the (single) post and the sidebar. The reason is: I want to create an additional category that is listed nowhere in the frontend, but is still accessible from the category-archive page. Got that? ;-) No?

« Read more about: Hide a single category in WordPress  »