WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to use PHP in some posts. These posts should look like normal posts, be in the archive and categories like normal posts an have tags.

I don't need PHP in every post, but it would be great if I could use it in some.

I saw that it is possible to create custom page templates which seems to be almost what I want, but I want it for posts. How can I get it?

share|improve this question
up vote 0 down vote accepted

You can edit the single.php and/or content-single.php files in your theme.

Then it depends what you mean by "some". You could apply some conditions to your code (only certain categories, certain tags, certain specific post IDs only, etc.)

You could also create a custom post type "myspecialposts" and create single-myspecialposts.php (codex)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.