admin管理员组文章数量:1130349
I have a custom post type "E-Books" with two categories "E-Book Title" and "Chapter Page", and custom meta boxes (table of contents, etc).
The E-Book post type uses one page template, and displays content based on category conditional.
<?php if (in_category('e-book-title')) { content } ?>
The "E-Book Title" posts are the parents and all meta info will be stored on these posts.
The "Chapter Page" posts are children of their respective "E-Book Title", and I would like each chapter page to grab the meta values of their parent.
For example, the table of contents meta will be stored for the title page "Book One", and when a new chapter post "Chapter One" is created with the assigned parent "Book One", the meta values from "Book One" will be stored for the new chapter post.
Is there a way to do this? I could manually enter the meta values in the chapter posts, but would be much user friendly if the chapter posts inherited their parents meta automatically.
I have a custom post type "E-Books" with two categories "E-Book Title" and "Chapter Page", and custom meta boxes (table of contents, etc).
The E-Book post type uses one page template, and displays content based on category conditional.
<?php if (in_category('e-book-title')) { content } ?>
The "E-Book Title" posts are the parents and all meta info will be stored on these posts.
The "Chapter Page" posts are children of their respective "E-Book Title", and I would like each chapter page to grab the meta values of their parent.
For example, the table of contents meta will be stored for the title page "Book One", and when a new chapter post "Chapter One" is created with the assigned parent "Book One", the meta values from "Book One" will be stored for the new chapter post.
Is there a way to do this? I could manually enter the meta values in the chapter posts, but would be much user friendly if the chapter posts inherited their parents meta automatically.
本文标签: phpGet meta values from parent post and save in child post
版权声明:本文标题:php - Get meta values from parent post and save in child post 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749061573a2310183.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论