Joe Nathan
Joe Nathan

Reputation: 1

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

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

Upvotes: 0

Views: 77

Answers (1)

leticia
leticia

Reputation: 2388

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

Upvotes: 2

Related Questions