featured

Here is code I usually use to find ancestor or parent of a category [php] function getCategoryAncestor($cat,$index=0){ $parentCatList = get_category_parents($cat,false,’,’); $parentCatListArray = @split(",",$parentCatList); $topParentName = $parentCatListArray[$index]; $charReplace = array(" " => "-", "(" => "", ")" => ""); $topParentSlug = strtolower(strtr($topParentName,$charReplace)); $catAncestor[‘ancestor’] = $topParentName; $catAncestor[‘ancestor_slug’] = $topParentSlug; return $catAncestor; } // How to use :…

Read More WordPress : How to get category ancestor

There are two types of hook in WordPress, filter and action. And in this occasion I will try to give examples about Actions hook. According to codex.wordpress.org: Actions: Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more…

Read More WordPress : Custom Action Hook in Action

Newscoop is an open source CMS used by hundreds of independent news organisations to publish content online. Sourcefabric are looking for individuals to create a new theme that brings together quality journalism, with quality design. The prize? A chance to meet media experts and develop their design with an all-expenses paid trip to Sourcecamp Prague…

Read More Newscoop Contest Design

I know we have get_permalink() in WordPress to get permalink by id of specific page. So this post is only alternative how to get the permalink by name, slug or title. 1. Get Page ID by name, slug or title [php] <?php function rh_get_page_id($name) { global $wpdb; // get page id using custom query $page_id…

Read More WordPress : Get page permalink by name, slug or title outside loop