Latest Snippets
Snippet: True in_category Conditional function
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.
Snippet: Configure Child Categories to use their Parent Category Template
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.
Snippet: Additional Links in Plugin Dashboard
Following snippet is specifically for WordPress Plugin developers. It lets the developer add additional links below their plugin descriptions and beside the “Activate” or “Deactivate” links. This is very handy to provide quick links related to your plugin or author.
Snippet: Set up a Cron Job in WordPress
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.
Snippet: Enable Shortcodes In Widgets and Post Titles
Shortcodes are one of the most popular feature of the WordPress. It allows you to trigger a function within the post contents. We posted number of shortcodes you can use. Couple of builtin shortcodes are [gallery] and [embed]. Unfortunately, shortcodes does not work in text widget where we often like to use them. To enable it, you just need to paste following snippet in your functions.php
Snippet: Add “alt” CSS Class to Alternative Posts
If you want to have different look and feel for post one after the another. This snippet will let do that quite easily. It will add “alt” class to alternative posts and you can then change, lets say, background color or border to make it different from the adjacent posts.





