Closed sajadghawami closed 8 years ago
Hi @leakingminds,
Check out the WordPress codex - I think get_category_parents
should do what you want.
Cheers,
Phil
Hey @ewels
thanks for the fast reply, but that gives me the parent category of the page, and not the one i gave it in the slider options!
Thanks, Sajad
Really? I thought it gave you the parent categories of whatever category id you pass to it? So you could pass it the category variable that you mention above:
echo get_category_parents( $atts['category'] );
I haven't tried it though, so apologies if I'm wrong about this.
You were right, the solutions works.
But i had to put it before the loop in
function cptbc_frontend($atts)
so basically i did this:
$page_id = get_the_ID();
$parent_page_id = wp_get_post_parent_id($page_id);
That works now!
thanks a bunch for your effort :)
Hey there,
i am trying to customize this plugin a little bit.
How would i get the parent?
Shows the current category, but i am trying to get the parent-category!
thanks for your help.