• Resolved shadez

    (@shadez)


    is there anyway to get the parents of category in an array, so that it can be displayed as a list? using only php or wp builtin functions?

    something like:

    $parentarray = get_category_parents( $cat, TRUE, "" );
    foreach ( $parentarray as $postparent ){
        echo "<li>  ". $parentarray ."</li>";
    }

    above code doesnt work. anybody got a workaround?

Viewing 1 replies (of 1 total)
  • Thread Starter shadez

    (@shadez)

    ok this was easy… solved it myself using explore..

    $parentstr = get_category_parents( $cat, TRUE, "," );
    $parentarr = explode(",",$parentstr);
    foreach ( $parentarr as $catparent ){
    ........
    }

    anybody got any better code pls share…

Viewing 1 replies (of 1 total)
  • The topic ‘Get parent categories in an Array – only php’ is closed to new replies.