WordPress.org

Support

Support » Plugins and Hacks » Custom Field Widget » [Resolved] Showing more than one field in the widget?

[Resolved] Showing more than one field in the widget?

Viewing 2 replies - 1 through 2 (of 2 total)
  • martinstoetzel

    @martinstoetzel

    Maybe this helps (it helped me):

    I changed the line in the code
    echo "\n<div class='customvalue'>\n$cvalue\n</div>\n";

    into:

    list($name,$src) = explode('<br />',$cvalue);
    echo "\n<div class='customvalue'>";
    echo "<a href=$src>$name</a>";
    echo "</div>";

    What it does is to treat $cvalue as array of two values ($src and $name) which are entered in separate lines in the custom field. I could then use $src and $name as arguments for creating a link.

    I guess you could do similar for showing other information which is put into different lines in your custom field.

    Note: I also had to remove the line
    $cvalue = apply_filters( 'custom_field_value', $cvalue );
    but I apologize for not knowing why…

    Credits: http://www.graphicbeacon.com/web-design-development/how-to-split-and-categorize-wordpress-custom-field-values/

    houseofstrauss

    @houseofstrauss

    Thanks for posting, that’s useful information that will definitely help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Showing more than one field in the widget?’ is closed to new replies.
Skip to toolbar