Im trying to figure out howto structure general content that should be easy to import in a page template.

Lets say for example i have some contact details and i want to include this content on multiple pages. One way i tried was to create a custom post type and just add posts for

  • Email
  • Phone
  • Address

I would then simply read the ID's of those posts and in my template hardcode the ID's into some get_post() calls, to extract the content.

The problem with this approach is

  1. im hardcoding ID
  2. lets say my Address needs different input fields like "Street" / "City" "Zipcode". Then i would need to create multiple custom post types, because i cant just add it to the same because it would make no sense for a email to have a zipcode field. I hope to get some pointers to how i would structure content like this. I guess i could write a custom plugin, but then i would miss out on all those features post's has like a rich text field and gallery support, and the support for adding more fields etc.

Using custom post types for this seems like a bad approach. Instead, create a simple option page in the admin using add_options_page, displayed in the menu under "Settings", for example.

Lay out some input fields for each piece of data you want to save. You can use the options API to read and write each field: get_option and update_option. You could also use shortcodes API to pull up options right inside the post editor.


Alternatively you could use the ICIT Spots plugin and shortcodes:


You can create arbitrary posts containing data and then include them in other posts via shortcodes, or using template function calls, or using widgets, etc You can add them from the widget area too and use them as a text widget with a built in editor, and you can add spot templates so that you can have different styles of spots.

Spots can appear multiple times too in different places.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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