ADVERTISEMENT



Google       

Home -> Law Blog Directory -> Legal Marketing & PR Blogs -> PaperStreet Web Design: SpeakOut

OR PHONE (866) 635-1838 for Bankruptcy Help, (866) 635-6190 for Divorce,
(866) 635-2689 for Personal Injury or (866) 635-9402 for Criminal Defense

Find a Local Lawyer

Bankruptcy (866) 635-1838
Divorce (866) 635-6190
Personal Injury (866) 635-2689
Criminal Defense (866) 635-9402

Bookmark

Legal Marketing & PR

: PaperStreet Web Design: SpeakOut

Wordpress Photo Selection / Rotation Using Option Field

By Peter Boyd

ADVERTISEMENTS

Question
Can Wordpress have a nice photo selection tool for the main header area for any post or pages of the web site? Can it default to a standard photo, if I don’t want to choose one?

Answer
Hell, yes!

How To
Just plugin this code where the usual photo in the header is placed.

<img src=”/wp-content/themes/paperstreet/images/photos/<?php $key=”photo”; if(get_post_meta($post->ID, $key, true) != “”) echo get_post_meta($post->ID, $key, true); if(get_post_meta($post->ID, $key, true) == “”) echo “girl.jpg”; ?>” />

Next, using the handy administrative area of Wordpress create a OPTION field in the actual Wordpress Page/Post that you are using.  Call the option field KEY “photo”.  Then put the image name in the value field (i.e. girl.jpg) that you want to use.  Of course, that photo needs to be uploaded to the correct directory, in this case /images/photos/ of the current paperstreet theme.

The above will pull from the photo option field that you added to the page/post. It will default to “girl.jpg” if you do not put in an option field.  Of course change “girl.jpg” above if you want to use a different image.

Full post as published by PaperStreet Web Design: SpeakOut on July 09, 2008 (boomark / email).

Bloggers, promote your law blog by nominating your blog for inclusion in USLaw.com's Law Blog Directory and RSS Reader. Benefits described.
Lawsuits and Settlements

Related Searches

























































































































US Law
#1 Online Legal Resource













Your Blog Subscriptions
Subscribe to blogs

10,000+ Law Job Listings
Lawyer . Police . Paralegal . Etc
Earn a law-related degree
Are you the author of this blog? Adding USLaw.com to your Blogroll increases relevance. You qualify to display a USLaw Network badge.
Suggest changes to this blog's description or nominate another for inclusion. Register for updates.


Practice Area
Zip Code:

Contact a Lawyer Now!






0.0168 secs (new cache)