开发者

How do I output custom data in a custom post in wordpress?

开发者 https://www.devze.com 2023-03-29 13:25 出处:网络
I made a custom post type in wordpress which takes extra values like $price, for example. I can save them a开发者_开发问答nd recall them in the back-end, but how can I display them on my new single-po

I made a custom post type in wordpress which takes extra values like $price, for example. I can save them a开发者_开发问答nd recall them in the back-end, but how can I display them on my new single-post.php page?


At http://codex.wordpress.org/Post_Types appears:

In the form of the single-type-template. In the same way that posts are shown on their own page with single.php, custom post types will use single-{posttype}.php if it's available.

So for the above example, you could create a single-acme_product.php file and the product posts would be shown using that template.

This means that you can create a new single template file with the name of you new custom type and display there the specific data for custom type, example:

single-post_with_price.php

0

精彩评论

暂无评论...
验证码 换一张
取 消