Category Archives: Code Snippet
This short snippet will add three colors (#15375c, #3366FF and #9fb83f) to color picker of WordPress editor. Its pretty useful if you allow administrators and authors to select the common colors of your website.
Many developer used Property, Car, Product and several others as a custom post type which, by default, sorted by publishing date (very odd). This fairly simple snippet details how one can add a sortable numeric column (for example a pricing column) in listing view of custom post type. It is quite useful as custom post types are getting popular day by day.
This is an advanced version of default in_category function. This function not only check for existance of post in the specified categories but also in all the subcategories down in the tree. It has same in_category parameters So you can use it in replacement of in_category.
WordPress categories follow a predefined template hierarchy. In most cases, we use “category-$slug.php” to override the template for an individual category to give it a entirely different look and functionality (“category-projects.php” for a “Project” category). If you have subcategories (Design, Development etc) of “Project” they also follow the WordPress template hierarchy and you have to create “category-design.php” and “category-development.php” to give them the similar look as of Projects category. This snippet allow you to configure some or all child categories to use their parent’s category template. In the scenario we just mentioned above, Design and Development categories will also land at “category-projects.php” instead of their own “category-$slug.php” template.
You are normally using your server’s Crontab to schedule your cron jobs. If you do not have access to server panel or you do not understand its functionality correctly, you can use WordPress’s job scheduling to execute your crons. You can set up cron for hourly execution, daily execution and executing twice in a day. Here is how you can set up hourly and daily jobs.