Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

Custom Field: Default Values


 
Prev Previous Post   Next Post Next
  #1  
Old Aug 22, 2009, 06:39 AM
gungo
 
31 posts · Jul 2009
San Juan, Puerto Rico
Custom Field: Default Values

I'm using a custom field to position a standard position image in my posts.

Not really knowing what I'm doing, I found an example somewhere and tried this:
custom field - image

I put this in the kicker area of the page/posts:
<img src="/wp-content/uploads/%meta('image')%" alt="%post-title%" />

This works fine as long as there is an image reference in the image field.
However, if the field is blank, I get an error plus an empty image box.

I can make this work by placing a blank .gif in the field every time I post something, but this will drive me crazy eventually.

Is there some php code that would insert the image if there is a value in the field, but leave the area blank (without error and image box) if there is no custom image field - or if the image field is blank?

If conditional code is not possible, would I be able to create a the field with a default value the same way that the meta fields are created when a new post is saved (I couldn't find where this was done).

I want to avoid anything that would be wiped out with theme upgrades.

Thanks!
 

Bookmarks

Tags
custom fields

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Line breaks in post content field? sammie Atahualpa 3 Wordpress theme 4 Nov 12, 2010 04:04 PM
Styling the comments area title font, form field and label font, and form field sizes jkintzele Comments, trackbacks & pings 5 Nov 10, 2009 09:18 AM
[SOLVED] Display Custom Fields and Values Under Post Heading grasshopper Atahualpa 3 Wordpress theme 4 Jul 2, 2009 12:40 PM
Unlinking the file structure depedency for image directories in favor of DB values i.avi Atahualpa 3 Wordpress theme 1 May 21, 2009 05:02 PM
How to turn of the form/text field shadow? Fux Atahualpa 3 Wordpress theme 2 Apr 27, 2009 08:06 PM


All times are GMT -6. The time now is 12:30 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.