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

  1. houseofstrauss
    Posted 2 years ago #

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


  2. martinstoetzel
    Posted 1 year ago #

    Maybe this helps (it helped me):

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


    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
    Posted 1 year 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

  • Custom Field Widget
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.