I use the free-blog theme and I have created a menue:
Home
page A
page B
Child page A
Child page B
Child page C
Page C
Child Post A
Child Post B
Now I want to create a bread crump. like_ Home-> Page B -> Child page A
So far this is not so difficult. I can get the Child Page Id without problems but I can't get the parent page ID. It is always 0.
I tried it with
$post_id = get_queried_object_id();
$post = get_post( $post_id );
$parent_link = get_permalink($post->post_parent);
$parent_title = get_the_title($post->post_parent);
$post->post_parent is always 0
then I tried
$parents = get_post_ancestors( post_id );
but the parents count is 0 too. The same with
wp_get_post_parent_id
So I wonder if I do something wrong when I created my menue. In the Child Post A I tried to select the category, but the parent value is still 0
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745544410a4632273.html
评论列表(0条)