admin管理员组文章数量:1122846
Note that this is all within a plugin if it makes a difference.
What I want to achieve...
I have a custom post type defined, with some related taxonomies. I would like to allow site admins to define one or more layouts for it using basic html and shortcodes. I will then allow the end users to select a layout and a taxonomy and will show a page with the layout repeated for each post in the taxonomy. To provide some context, my custom post type represents a recipe, and the admin might want to define one layout showing just the name and the allergens, and another layout showing the name, a thumbnail and full ingredient details. On selecting a taxonomy and layout style, all posts in the taxonomy should be shown to the end user.
I'm not sure of the best way to approach this. My current thinking is that I have a template that manages setting the WP_Query parameters. The admin can then define any number of pages that each represent a layout, as long as they use the template I will include in the plugin. So effectively the page defines the layout for a single post, and when it is selected by the end user I will need that page to loop, repeating itself for each post in the chosen taxonomy. I would then define a new custom post type to represent the layout, where the admin could define a name for it, the associated page and a few other meta fields.
Am I thinking about this the wrong way? Repeating the page for each post feels odd, but I'm not sure how else to give the admins a way to define their layouts.
本文标签: How can I allow plugin users to define layouts for a custom post type
版权声明:本文标题:How can I allow plugin users to define layouts for a custom post type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736301867a1931324.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论