How to Change the WordPress Default Permalinks for Pages

permalinks

WordPress permalinks are not nearly as flexible as I would like them to be. It offers the ability to easily change the Post permalink structure, as well as the category and tag structure, but that’s where it ends. You have the option of using a plugin like Custom Permalinks, if you want the ability to [...]

Auto-Update WordPress with XAMPP for OS X

XAMPP for OS X - WordPress

XAMPP is a great application for running your own local development environment. It’s available for Linux, Windows, and Mac OS X. Personally, XAMPP is the only local environment app I use. Out of the box, XAMPP doesn’t allow for automatic updates inside WordPress. Not for plugins, not for themes, not for core. The Problem WordPress [...]

How to Download a Video Thumbnail and Set as the Featured Image

WordPress Video Thumbnails

One feature that hasn’t made it into WordPress yet, is the ability to use external images as a Featured Image. I don’t know if it will ever become a feature, so in the mean time, I wrote this plugin. There are certainly other plugins that are more robust, like Video Thumbnails — I am making [...]

Fatal Error: Allowed Memory Size in WordPress is Exhausted

wordpress-php-memory

WordPress can often run into memory issues with the web server. The WordPress Core team is constantly working on lowering memory footprints though. There are a few reasons why you may be running into memory issues with WordPress, let’s dive into them below and discuss some potential solutions for you. Example Errors Here are some [...]

How to Disable Auto-Saving in WordPress

wordpress-code

WordPress offers auto-save functionality making it easy to ensure your work isn’t lost. However, post revisions can add up quickly. Here are some tips to disable the post revisions and auto-save functionality. Disable Auto-saving Add this to your functions.php file: **NOTE** if you disable autosave, it prevents the “preview” function from working as you would [...]

How to Prevent the WPAutoP Filter in a Shortcode

wordpress-code

As I was developing a simple shortcode the other day, I realized the output was being filtered by wpautop(), which adds <p></p> to the return code. I finally found a snippet of code from BetterWP.net which solved exactly my problem. The main issues was that the shortcode was being processed too late in the code, [...]

How to Get the Thumbnail URL Path

wordpress-code

Here is a quick and easy way to extract the URL source for the thumbnail [of the featured img] of your post. Inside the Loop Outside the Loop If you also needed to get the height and width of the thumbnail, you can use the follow lines of code: You can read more on the [...]

How to Apply Custom CSS to Specific Browsers

WordPress Body Tag

It’s common knowledge that not every browser is created equally. Often, you will need to write some custom CSS for a specific browser because there’s either too much margin top or not enough padding in that div. Whatever the case may be, here’s an easy way to get around it. Add the code below to [...]

How to Get Your Twitter, Facebook, and Google+ Fan/Follower Count in PHP and WordPress

google-facebook-twitter

The code snippets below will provide you a function that you can echo anywhere on your site, to get the count for each social service. The snippets below will let you get your Twitter follower count, your Facebook like count, and your Google+ circle count. Let’s take a look at the code. Twitter Follower Count [...]

How to Show Your Latest Tweet Without a Plugin

twitter-logo

Here is a great little snippet of code that will let you easily display your latest tweet anywhere you want to on your side. via Smashing Magazine

How to Check if a Post has More than One Image Attached

WordPress Logo

Here is a pretty simple statement that will check your post to see if there is more than one image attached. If you want to check the post to see if it has any image attachments at all, try this:

How to Detect if a Post has at least One Image

WordPress Logo

Here’s quick WordPress code snippet that will let you easily detect if a post has at least one image in it.

The Ultimate Body Tags

wordpress-body_150

It can be really easy to style your content and site if you have the right body tags setup and know a little bit of CSS. Here is the ultimate set of body tags that will let you easily style everything from the <body> down. Something to note about the page404 class, you need to [...]

How to Mass Delete Users Based on their Role

delete

@MattBrett tweeted out a couple days ago, asking how to mass delete users specific to what role they were. For example, being able to delete 15,000 users that were all “subscribers” in WordPress. There is not a native way to do this, as this would be a rare edge case that you would either have [...]

Exclude Posts from the RSS Feed by Tag or Category

rss-feed

Sometimes you may want to publish a post, but not have it distributed to your RSS feed or mailing list. For whatever reason you may have to want to do this, there is a simple solution to achieve this. One of the things to pay close attention to below, is that all of these use [...]

How to Disable WordPress’ AutoP

WordPress Logo

Have you ever needed to disable the infamous wpautop that WordPress automatically inserts into posts and pages? Here’s a quick snippet of code that lets you easily manage it using custom fields. Add the below code to your functions.php file. function disable_autop() { global $post; $disable_autop_var = get_post_meta($post->ID, ‘disable_autop’, TRUE); if ( !empty( $disable_autop_var ) [...]

Automatically Set the Featured Image in WordPress

checkmark

Often I find myself forgetting to click on “featured image” when I’m writing a post. But I know I need one because it makes the world go ’round for WP Force. What’s the solution? Automatically set the featured image. Here’s a quick snippet of code you can throw into your functions.php file that will your [...]