How To Add Category ID To Body And Post Class In WordPress

Here’s a snippet which comes very handy if you want to add category ID to body and post class in WordPress for customizing your blog posts. After adding this snippet, you can start styling your posts depending on which category it belongs. It’s an amazing tip to change background or color theme for your categories. …

How To Add Category ID To Body And Post Class In WordPressRead More »

How To Set WordPress Offline For Scheduled Maintenance

Here’s a snippet which allows you to notify your users when you set your WordPress offline for scheduled maintenance. We will use the wp_die functions. The best part about this code is it only shows the maintenance message for non-admin users, while the website admins can still access the /wp-admin/ path. Just add the following …

How To Set WordPress Offline For Scheduled MaintenanceRead More »

How To Add Drop Down Category List To WordPress

I was working with a theme, where I wanted to give users an option to view the categories by selecting it from a drop down category list. I used the following snippet to do that job:

Which looked good, but failed! The above snippet just renders a drop down list, which doesn’t allow you …

How To Add Drop Down Category List To WordPressRead More »

How To Auto-Redirect When WordPress Search Only Returns One Post

This is something that I’m currently using on this website, and a snippet which I really like. Here’s a snippet which will automatically redirect your users when the search only returns one post in your WordPress. Just add the following snippet to your current theme’s functions.php file:

How To Display Post Attachment Count In WordPress Posts Screen

Some people run WordPress websites where they post articles with multiple attachments and here’s something useful for them. Here’s snippet which allow yous to display post attachment count in WordPress posts screen, so you can easily see the number of media attached to a post. Just add following snippet to your current theme’s functions.php file: …

How To Display Post Attachment Count In WordPress Posts ScreenRead More »

How To Remove Paragraph Tags From Around Images In WordPress

In January, I posted how much I really hate WordPress’ automatic post formatting, and we will continue it today on this post. That tutorial removes automatic paragraph tags in WordPress, but what if we just want to remove them from images? Here’s how you can remove paragraph tags from around images in WordPress to make …

How To Remove Paragraph Tags From Around Images In WordPressRead More »

How To Force Two-Step Authentication In Jetpack SSO

Last week I shared how to enable two-step authentication in your WordPress using Jetpack’s Single Sign On module. However, there is one problem in Jetpack’s SSO module. Even after you enable two-step authentication, a visitor can easily sign-in with the login form, and he won’t have to complete two-step authentication process. Here’s way which will …

How To Force Two-Step Authentication In Jetpack SSORead More »

How To Redirect Dead-End Category, Search And Tag URLs In WordPress

Since WordPress 2.5, WordPress automatically handles many redirections on your blog. If you’re using a pretty permalinks in your blog, WordPress will redirect the following three URLs results in 404 (Page Not Found) errors: http://www.example.com/tag/ http://www.example.com/category/ http://www.example.com/search/ These three pages doesn’t exist by default. However, a visitor of your website and search engines, such as …

How To Redirect Dead-End Category, Search And Tag URLs In WordPressRead More »