Support » Developing with WordPress » Custom Fields Nightmare…

  • I’m having serious troubles implementing a simple custom field usage.
    It makes me want to cry and burn down my house.
    Why wordpress… Why?

    I’d very much like to use a custom field to have a nice image header before my post title and title.

    I’m not sure why or how, but custom fields with images just do not seem to work.
    These things don’t even need CSS.

    They just need to show up.
    I’d like the site to look like this:

Viewing 1 replies (of 1 total)
  • they will work. I use the c2c_get_custom() plugin to get the meta data but the big issue is to be sure to logically plan how you are writing the results…

    rather than entering the html associated with the image, just use the file name and in the code calling the field values, add the tag and such…

    for example, using c2c_get_custom plugin, let’s assume I put the image file name “foo.jpg” into a custom key named “post-pic”:

    echo c2c_get_custom('post-pic','<img src="/wp-content/themes/mythemesname/images/','" />','','');

    if you have several pictures, you’d add several fields (using the same key) and you’d place a space in the 4th parameter to tell WP to show more than one field.

    from the website’s information about the plugin:

    function c2c_get_custom ($field, $before=”, $after=”, $none=”, $between=”, $before_last=”)

    * $field : This is the name of the custom field you wish to display
    * $before : The text/HTML to display before all field value(s)
    * $after : The text/HTML to display after all field value(s)
    * $none : The text/HTML to display in place of the field value should no field value exists; if defined as ” and no field value exists, then nothing (including no $before and $after) gets displayed
    * $between : The text/HTML to display between multiple occurrences of the custom field; if defined as “, then only the first instance will be used
    * $before_last : The text to display between the next-to-last and last items listed when multiple occurrences of the custom field; $between MUST be set to something other than ” for this to take effect


Viewing 1 replies (of 1 total)
  • The topic ‘Custom Fields Nightmare…’ is closed to new replies.