I'm asking for some grace on this question - I lack sufficient knowledge of both WP and PHP to be more specific ... so here goes:

I'd like to associate some "meta" information about my website into the content; for example a tree (e.g. Maple), so that I can use a PHP tag (and/or shortcode) to say something like <? echo $tree ?> and get a value printed out. The reason for this is because I'm planning to set up multiple sites using MU with a different focus and some of the content will be dynamic and some manual.

What is the recommended way in WordPress to do something like this? Is this something I can define in functions.php and then grab at my leisure?

PS - is this possibly a custom field thing? I may want this content to appear anywhere (header, sidebar, footer, in page content [etc.])

  • Do you need a backend interface for this or are you happy with hard-coded data? Is this "meta" information site-wide or network-wide?
    – s_ha_dum
    Apr 23, 2013 at 21:59

1 Answer 1

  • Store site specific data in regular options. See add_option(), get_option() and so on.

  • Store options for the complete network in a site option. See add_site_option() and related functions.

You can add new fields for these options in a separate admin page or use an existing page for that. For the latter see my plugin Public Contact Data which does exactly what are asking for. It adds dynamic shortcodes too. :)

  • Thanks for the responding question and answer; I've decided not to use WPMU at this point and hard code it instead :)
    – Drewdavid
    Apr 24, 2013 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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