Assign a color to a category in WordPress

In a previous post I’ve showed how to add a like button in category/tag/etc archive page with the term meta function introduced in WordPress 4.4. I’ve also had another post about how to add additional fields to Category and Taxonomy. Since it’s posted before WordPress 4.4, the data of custom fields are saved using a … Continue reading “Assign a color to a category in WordPress”

Add Custom Post States to WordPress posts and pages

You may find that in the post list tables there are some posts/pages title followed by certain conditions. For example, scheduled posts, draft posts and so on they are all flagged with corresponding states. This also applies to pages. On a recent project, I’d like to add a custom state to all pages if they … Continue reading “Add Custom Post States to WordPress posts and pages”

Redirecting 404 Error Pages to any page in WordPress

404’s are part of every website. In WordPress, most themes has a 404.php template file and WordPress will automatically use that page if a Page Not Found error occurs. In this post, I’ll show you how to redirect 404 page to any page in WordPress. Method #1 Open your 404.php file in your theme’s folder. … Continue reading “Redirecting 404 Error Pages to any page in WordPress”

Add a Like button to category/tag/taxonomy pages

In en earlier post I’ve showed you how we can add a like it button to a post/page without a plugin. How to add a like button without a plugin I’ve got a message asking how to also add this kind of button to a category/tag page. As we have stored the likes data as … Continue reading “Add a Like button to category/tag/taxonomy pages”

Add Custom Field to Category and Taxonomies

There were some general fields for each taxonomy(Category, Tag, etc): name, slug, parent and description. Now and then we’ll feel the need to add a custom field. In a recent a project I am working on, the client want to display the category with an image that he can select from the backend. There is … Continue reading “Add Custom Field to Category and Taxonomies”

How to get Featured Image URL

WordPress made it pretty easy to use featured image by introducing “post-thumbnail” support. Simply add below line to your theme’s functions.php and you’ll get a “Featured Image” section on the post edit screen where you can select and set a featured image. add_theme_support(‘post-thumbnails’); The usage is also just work of one piece of code. Use … Continue reading “How to get Featured Image URL”

List all image sizes in a WordPress post

WordPress by default will generate 3 types of image sizes: thumbnail, medium and large. Since version 2.9, WordPress has added post thumbnail feature that allows us to add more image sizes in order to use them more flexibly. If you are running a image based website, like Wallpaper download site, it’s always good to list … Continue reading “List all image sizes in a WordPress post”

Tell your visitors how long a post will take to read

As an avid internet user, I always skimmed articles because I didn’t want to spend too long reading a post. This problem isn’t very unique. Many people don’t read full articles and hence miss many valuable gold-nuggets hidden in the text. Then I came to know that medium.com has “time to read” feature that will … Continue reading “Tell your visitors how long a post will take to read”