Posted By

innerstorm on 06/27/11


Tagged


Versions (?)

wp get top parent category


 / Published in: PHP
 

  1. <?php
  2. $parentCatList = get_category_parents($cat,false,',');
  3. $parentCatListArray = split(",",$parentCatList);
  4. $topParentName = $parentCatListArray[0];
  5. $sdacReplace = array(" " => "-", "(" => "", ")" => "");
  6. $topParent = strtolower(strtr($topParentName,$sdacReplace));
  7. ?>

Report this snippet  

You need to login to post a comment.