breadcrumb - Can't get parent page id

I use the free-blog theme and I have created a menue:Homepage Apage BChild page AChild page BChild page CPage CChild Pos

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

相关推荐

  • breadcrumb - Can't get parent page id

    I use the free-blog theme and I have created a menue:Homepage Apage BChild page AChild page BChild page CPage CChild Pos

    13小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信