• 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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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…

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

    Note the third “false” parameter above from:
    http://codex.wordpress.org/Function_Reference/get_post_meta#Parameters

    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)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom field with multiple value?’ is closed to new replies.