admin管理员组文章数量:1122832
Is it posible to get the parent ID of an single page.... I mean not a Page I mean an is_single()... page.
I have a page witch contains some custom posts and when I click on one of these i came to the single page of these entree. I would like to get the permalink of the parent page, the page i come from.
Is it posible to get the parent ID of an single page.... I mean not a Page I mean an is_single()... page.
I have a page witch contains some custom posts and when I click on one of these i came to the single page of these entree. I would like to get the permalink of the parent page, the page i come from.
Share Improve this question asked May 14, 2013 at 22:20 user1606423user1606423 414 bronze badges 01 Answer
Reset to default 0For a hierarchical post type, you can use $post->post_parent
and get_permalink()
, perhaps like so:
<?php
global $post;
$parent_permalink = get_permalink( $post->post_parent );
?>
<a href="<?php echo $parent_permalink; ?>">Parent Post</a>
本文标签: pagesParent for a single (singlephp)
版权声明:本文标题:pages - Parent for a single (single.php) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736281421a1926313.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论