Posted by & filed under WordPress.

Usage Use [year] in your posts. Snippet Place the code above in functions.php file function year_shortcode() { $year = date(‘Y’); return $year; } add_shortcode(‘year’, ‘year_shortcode’);

Posted by & filed under WordPress.

Sometimes you need sub-categories to inherit their parent’s archive/category template. But it’s not supported by default. Here is a little filter that does that for you! function new_subcategory_hierarchy() { $category = get_queried_object(); $temp = $category; do { $parent_id = $temp->category_parent; $temp = get_category( $parent_id ); } while ( $temp->category_parent ); $templates = array(); if (

Continue reading →