WordPress Exclude Custom Post Type from Search
Out of the box, WordPress search results include matches from any Custom Post Types that may be enabled via the theme template. For example, at htaccessbook.com, any matching content found in forum posts will be included in search results. This default behavior can be super convenient, but it is not always desirable. In this quick […]
jQuery Fade Out Element
Here is a simple jQuery technique to fade out any element on the page. It uses jQuery’s .hide() method to animate the fade-out of the specified element.
.htaccess enable compression
Two quick code snippets for compressing your file output with Apache’s mod_deflate (gzip). Compressing your content is a great way to improve performance by decreasing the amount of data that is sent to the client.
Disable Pinterest on Your Pages
Pinterest is a social-media service that people can use to collect your site’s images. The Pinterest browser extension and app add a “Pin it” (or whatever) button to the images that are included on your web pages. That way users can just click a button to add your images to their account on Pinterest. Fortunately, […]
jQuery Get Number of Paragraphs
Quick jQuery code snippet to get the number of paragraphs in the specified element. The technique can be modified easily to get the number of any element.
PHP Add and Remove Query String Variables
Two quick functions, one for adding a query string variable and another to remove a query string variable. Either of these functions can be used in any PHP script to modify query-string parameters.
Moto G Disable Sync
The Moto G Android phone by default syncs everything with your Google account. That’s fine for people who are not concerned about their privacy, but for everyone else here are the steps required to disable auto-sync on Moto G (and similar) phones.
WordPress Change Default Number of Displayed Posts
By default, WordPress displays the same number of posts for the home page (when it is set to display posts) and all types of archive views. To change the default number of posts displayed for any specific view, you can add this simple function to your theme’s functions.php file.
PHP Shorten String by Character Count
Quick copy-n-paste function to truncate or shorten a string of text to a specific number of characters. Useful for things like “next” and “previous” navigation links and so forth.
CSS Dark Pre Tag Styles
Here is a quick CSS snippet for adding some smooth, dark styles to any <pre> tag. One-step snippet for complete pre styling: add to your stylesheet and done.
WordPress Shortcode Display Search Form
Here is an easy custom WordPress function to display your theme’s search form via shortcode. This makes it easy to display the search form on any Post or Page.
PHP Check if Request is HTTPS
Here we have a simple and effective PHP function that checks whether or not HTTPS (via SSL) is used for the current request.