Custom field with multiple value? (3 posts)

  1. yhosi
    Posted 4 years ago #

    I want multiple values for one custom field.
    The value should change if a vistor clicks on a link on my blog.

    For example:

    I have a custom field named "picture".
    This custom field should contain 2 different values.
    One Value should be "www.example.com/picture1.jpg" the other value should be "www.example.com/picture2.jpg".

    If someone clicks on a link "Picture 1" or "Picture 2" the value of the custom field should change to the specified value.

    Please help! I am begging you please, please help!

  2. Cudazi
    Posted 4 years ago #

    You can add multiple custom fields using the same key on your post or page.

    While I don't know your specific theme setup, you can loop through each via this simplified script below...

    $pictures = get_post_meta($post->ID, 'picture', false);
    foreach($pictures as $picture) {
     echo $picture; // do something

    Note the third "false" parameter above from:

  3. yhosi_2
    Posted 4 years ago #

    But how do I make this, if somebody clicks on a link and the value changes?

    Thank you very much for your reply.

    (Sorry, I lost my password that's why this is another account)

Topic Closed

This topic has been closed to new replies.

About this Topic