Popular Posts
All posts ordered by popularity
WordPress: Get All User Roles
WordPress makes it easy to get the current user’s role(s) by using wp_get_current_user(). But what if you want to get all roles from all users. Like a list of every role that is used on your site. Well good news, WordPress provides a global object named $wp_roles that provides the information. So if you’re looking […]
Protect files with .htaccess
Here are some examples of how to use .htaccess to protect any sensitive files on the server.
Disable extra p tags in WP shortcodes
When WordPress processes shortcodes, it first passes the content through its wpautop() function to convert line breaks to <p></p> or <br /> tags. This order of processing can lead to unwanted paragraph and breaks scattered throughout your shortcode content. This post provides a simple way to prevent this from happening, so you can keep your […]
Set PHP Limits with .htaccess
A quick summary of some of the PHP limits that can be set via the .htaccess file.
Remove .DS_Store in macOS
I would give my left testicle to stop macOS from creating .DS_Store files in every freaking directory on the system. The stupid files have been driving Mac users mad for years, and apparently there is no end in sight. Fortunately, there are a couple of ways to remove them.
Disable manual resizing with meta viewport
Just a quick snippet for telling the browser to disable manual resizing of the page. You can see this technique in use here at WP-Mix as well as most of my other websites. If you view the source code of any web page on the site, you can see the meta viewport tag in effect […]
WordPress Get Recent Comments
In this tutorial, you’ll learn two ways to get the most recent comments on your WordPress-powered site. The first method uses get_comments(),and the second method uses the newer WP_Comment_Query class.
WordPress: Get Current URL and Slug
Another essential tool for your WordPress development toolbox is getting the URL of the current page. This sounds simple but can be tricky depending on which page or type of page is being displayed. So to help, here is a simple technique to get the current URL for any single post, archive view, custom template, […]
Disable or customize WP read more link
Quick snippet for customizing or disabling the WordPress “read more” link for the_excerpt().
Tabbed sidebar menu with jQuery
Here’s an clean, simple way to add a tabbed sidebar menu using jQuery. You can see an example in the Introspection WP Theme.
Simple PHP login form
Here’s a quick PHP snippet for creating a simple login form for your site.
PHP: Get $_SERVER Variables
I use a variation of this function to get super global $_SERVER variables in my free shapeSpace WordPress theme. The function returns all relevant variables contained in the $_SERVER array. Note this is a general PHP technique, so WordPress is not required for this one.