Tips & Tricks

This code will track product purchase / checkout. Copy and paste below codes to your functions.php and don’t forget to change xxxxxxxxxx with your own facebook pixel code.


Read More Embed facebook conversion pixel for woocommerce

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

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