Quick collection of code snippets to help customize post dates to reflect most-recent-update information. I use this technique here at WP-Mix, DigWP, and elsewhere. Using the most recent date as the post date can boost the SEO value of your site.
In this post, we add title attributes to WordPress post-navigation links, for both previous/next archive navigation and previous/next single-post navigation. These are some simple copy/paste functions that you can add directly to your theme (or via plugin).
Quick CSS snippet for you, sort of hard to explain but basically it’s an effect whereby the background color slides up when the link is hovered. Keep reading to check out a demo and grab the code.
When working on a live site (which of course you should never do), it may be useful to execute some PHP script only for your own IP address. This quick tutorial provides a simple script that can make it happen. $referer = isset($_SERVER[‘HTTP_REFERER’]) ? _SERVER[‘HTTP_REFERER’] : ‘undefined’; $agent = isset($_SERVER[‘HTTP_USER_AGENT’]) ? $_SERVER[‘HTTP_USER_AGENT’] : ‘undefined’; $address […]
Including files plays an important role in PHP development. For example, your app may consist of a main plugin file that includes several smaller files, each of which contains some distinct bit of functionality. When including such files, it’s a good idea to protect them against direct access. This tutorial rounds up a bunch of […]
This code snippet takes a string of text and removes all carriage returns, new lines, and tabs, replacing any matches with a simple blank space. An ideal way to “stringify” a potentially formatted lump of alphanumeric text.
Ahh yeah, here are some sweet little code snippets to customize the default WordPress oEmbed functionality. Techniques include modifying default oEmbed size, markup, as well as enabling oEmbed for Post Excerpts and Custom Fields.
Here are some quick tips to help troubleshoot and fix image and file upload errors in WordPress. Hopefully it helps someone out there get things back on track with their uploaded images. I know it can be frustrating!
This post shows a quick and easy way to require that the user is logged in to WordPress in order to gain access to some private content.
Example snippet showing how to redirect from one URL to another, changing only a single parameter in the query string. It’s a subtle but a commonly used technique, especially in the SEO field, where URLs are changed frequently to optimize for structure, keywords, etc.
I use these snippets all the time, so I’m posting them here at WP-Mix for easy access. The first shortcode can be used to display content only to logged-in users (based on capability). And the second shortcode can be used to display content only to visitors (non-logged-in users).