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

My client wants to have several pages in which he can edit small, separate parts of a Wordpress page. For example, there is a callout box in the upper left corner. There is also a small piece of text showing contact information in the lower right corner. I'd like to be able to have all of these pieces of text editable in the same place.

My idea is to have a post structured using shortcodes; something like this:

This is the top callout text.

341 Address Rd.
City Comma State 23422


and so on. Is there a way to extract the content of the shortcodes into loop variables? That way in a theme php file I could do something like:

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <?php echo $post->top_callout; ?>
    <?php echo $post->bottom_contact_info; ?>
<?php endwhile; ?>

Or, is there a better way to do this?

share|improve this question

A much better way to do that would be to use custom fields so you could pull the data in the loop by using get_post_custom or get_post_meta.

And to make it even easier on your client you can create your own meta box either by code or using a plugin like verve meta box with separate textareas ,input fields, or even WYSIWYG editors.

share|improve this answer
i use WPAlchemy for creating my metaboxes, but that's definitely the way to go. – helgatheviking Aug 13 '11 at 13:42

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.