rss

More creative uses for custom fields

10 Apr, 2008 Page,Single

So your client has a small area of their site that displays their contact numbers. It’s one of those small features that most sites have, but its also a feature that you don’t want to be bugged with when it changes or when they need something edited. Here’s a simple guide to how you can use custom fields for this.

Choose a page on their site that you know will be kept throughout the life of their site – Perhaps an ‘about us’ page. Create custom fields for each of their contact details, maybe:

  • Telephone: 012 345 6789
  • Fax: 012 345 6789
  • Email Address: info@site.com

Then, use your special query to call the custom field for each of those

<div id="contactdetails">
	<ul>
		<li>Telephone: <? echo get_post_meta(2, 'telephone', true) ?></li>
		<li>Fax: <? echo get_post_meta(2, 'fax', true) ?></li>
		<li>Email: <a href= "mailto:<? echo get_post_meta(2, 'email', true) ?>"><? echo get_post_meta(2, 'email', true) ?></a></li>
	</ul>
</div>

Note that in this example, ’2′ is the page_id of the about us page. Change this number to whatever the ID is of the page that you use to keep this information.

8 Comments

  1. This is really good article. Thanks for sharing.

  2. Thanks Sarah, Glad you enjoyed it.

  3. Hi there! I know this is kinda off topic however
    , I’d figured I’d ask. Would you be interested in exchanging links or
    maybe guest writing a blog article or vice-versa?
    My site goes over a lot of the same topics as yours and I think we could greatly
    benefit from each other. If you happen to be interested feel free to send me an email.
    I look forward to hearing from you! Great blog
    by the way!

  4. Hi there! This post could not be written much better! Going through this post reminds me
    of my previous roommate! He continually kept preaching about this.
    I am going to send this article to him. Fairly certain he’ll have a great read.
    I appreciate you for sharing!

  5. Thanks for the good writeup. It in truth was once a enjoyment account it.

    Look advanced to more added agreeable from you! However, how
    could we communicate?

  6. As a jungle he is one of my favorite pick due
    to his bandage toss ability where you close the distance between you and enemy champions.
    I am sure you will agree that too many times recently the UFC fights are really example of “bad boxing” rather than good MMA.
    The list of jersey types are rather extensive with there being
    authentic NFL jerseys that are made for all ages and both genders, such
    as youth jerseys, personalized, throwback, and much more.

  7. ) that contains lycopene, one of the most powerful
    antioxidants that can fight against cell damage.
    One of the types is flies that are really painful and so irritating.

    Home recording studio software should offer you powerful tools for recording, editing and mixing audio tracks in the comfort of
    your own home.

  8. Hi, I think your site might be havingg browser compatibiility issues.
    When I look att your blog site in Ie, it looks fine buut when opening in Internet Explorer, it has some
    overlapping. I just wanted to give you a quick heads up!
    Other then that, very good blog!

Leave a Reply

About The WordPress Guru

Over the last 4 or 5 years, I’ve been digging into the Wonders of WordPress. From the days when the Classic theme was the shizz until now, WordPress has gone from strength to strength both as the blogging platform of choice for many big players and as a CMS with...

Learn more »