When creating a custom taxonomy in WordPress, you get a different default interface for hierarchical taxonomies than for non-hierarchical taxonomies. Hierarchical taxonomies get a checkbox-based interface, like Categories, while non-hierarchical taxonomies get an auto-complete interface, like Tags.
You can select the metabox interface used with the ‘meta_box_cb’ attribute of the ‘register_taxonomy’ call. By default, hierarchical taxonomies use the callback ‘post_categories_meta_box’ and non-hierarchical taxonomies use the callback ‘post_tags_metabox’. Unfortunately, the two options aren’t compatible with each other. read more »
WordPress 4.4 brought an awesome new feature to the CMS system: Responsive images. As of 4.4, WordPress automatically adds the HTML5 srcset attribute to the image tags that it auto-generates. These srcset attributes define other sizes of the image, to be downloaded on devices with other screen resolutions and orientations. Using responsive image tags allows sites to load faster on mobile, use less data, and be optimized better for the viewer’s screen.
Unfortunately, because of the way WordPress implemented the feature, these new srcset attributes can cause trouble on some sites.
If you are using Cloudflare, with Universal SSL, or if you are serving your site over both HTTP and HTTPS, you may see broken image tags in Chrome, or receive security warnings in other browsers.
The problem is pretty simple. Wordpress expects your site to be served at the address stored in the ‘siteurl’ option, including the protocol stored there. The new srcset image urls are built from that assumption, without running through the usual filters. So, HTTPS sites can end up serving HTTP images in the srcset tag, causing all kinds of trouble.
Lockily, I’ve come up with a simple fix for the problem. Just add the following code to your functions.php file, and your srcset images will all be served as protocol-independent urls:
This same approach can also be used to fix CDN urls in srcset tags, by using a different replace function.
Buddypress is a great option for running closed social networks in WordPress. However, if it doesn’t perfectly fit your needs out of the box, you’ll soon realize that it has some serious shortcomings.
Consider a text-based company logo. It may have an aspect ratio of 3:1, but a square crop of the image would lose all meaning, and look sloppy. You could tell users to send it to a graphic designer to get a square version created, but that is a great way to lose users. Instead, I tackled the issue programmatically.
If you require the following script in your theme’s functions.php file, it will detect when users upload non-square profile photos, and will add padding to make them square, before displaying the crop interface. That way, if the image must remain complete, it can simply be displayed centered in the square, with padding surrounding it.
One of the more complicated things to handle in wordpress is creating a “team” page that is attractive and easy to maintain. Many designers use pre-packaged plugins that remove a level of control, or create these pages as flat pages with complicated custom layouts (sometimes with the assistance of Visual Composer or another complicated shortcode library).
The same issue tends to carry over to other ‘aggregate’ pages like “board of directors” or “testimonials”. However, it’s actually fairly simple to implement these pages as a Custom Post Type, giving content-editors a simple post interface to add and delete team members, and making front-end layout a simple job for a custom template and some css.
read more »