WP-Mix

A fresh mix of code snippets and tutorials

Publish a post via functions.php

Normally users create new posts from the Posts Edit screen in the WordPress Admin, but you can also publish posts from the functions.php file.

Disable theme switching

By default WordPress enables users to switch themes while working in the Admin area. Sometimes a user might screw this up and accidentally activate the wrong theme.

WordPress navigation outside the loop

Normally the template tags used for navigating posts and pages must be included inside of the WordPress loop. This is great but there may be times when you need to display the navigation links outside of the loop.

Display user-friendly dates and times

Normally WordPress displays dates using boring old numbers. How much more fun would it be to display dates and times using human-readable language to make them all user-friendly and swell.

Display a number for each post

To display an auto-incrementing number for each post, add the following snippet to your theme’s functions.php file:

Increase upload limits for WordPress

If you’re encountering restrictive upload limits in WordPress, here is a simple fix:

Remove sub-menus

Quick snippet for removing or disabling WordPress sub-menus:

Disable default WordPress widgets

Delivering a clean custom theme involves removing components or features that will not be used. Here’s how to disable WordPress default widgets:

How to change your theme’s appearance

If you want to change certain aspects of your theme, you should get familar with its different files.

Why aren’t permalinks working?

Here is a quick guide for troubleshooting why WordPress permalinks might not be working.

Random WordPress Snippets

Just a collection of miscellaneous & random WordPress snippets for your enjoyment.

Exclude category in WordPress

Ever wanted to exclude a category in WordPress? Turns out it’s pretty easy to do without having to install another plugin.