WordPress.org

Ready to get started?Download WordPress

Forums

Custom Field Widget
[resolved] Showing more than one field in the widget? (3 posts)

  1. houseofstrauss
    Member
    Posted 1 year ago #

    Want to show author, website and email, but all in the same widget, obviously. Can we do this?

    http://wordpress.org/extend/plugins/custom-field-widget/

  2. martinstoetzel
    Member
    Posted 9 months ago #

    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/

  3. houseofstrauss
    Member
    Posted 9 months ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.