WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Custom Field Template] Add text box if previous is not null

[Resolved] [Plugin: Custom Field Template] Add text box if previous is not null

Viewing 3 replies - 1 through 3 (of 3 total)
  • Edd Hurst
    Participant

    @eddhurst

    The easiest way for you to do this is to use the Multiple argument. This will automatically add an extra field to your set, so you will always be able to add more fields to your slideshow.

    This is also a lot neater codewise.

    example:

    [Main Image]
    type = file
    label = Upload Main Image ( 940px by 280px )
    mediaLibrary = true
    multiple = true
    multipleButton = true

    “Multiple” will allow you to add more fields so that when you upload 4 and save – it will automatically show your 4 fields and 1 empty one when you next load the page.

    “MultipleButton” will allow you to manually add more fields, if you wanted to add more than one at a time.

    Edd Hurst
    Participant

    @eddhurst

    for what it’s worth – you would retrieve those much the same as you would a normal custom field.

    <?php
    $slideshow_images = get_post_custom_values('Main Image', $post->ID);
    foreach ( $slideshow_images as $key => $value ) {
    	echo "<div class=\"slideshow-img\">";
    	echo $value;
    	echo "</div>";
    }
    ?>

    I can’t remember how cft outputs a file, but in theory that would work…

    seanjacob
    Member

    @seanjacob

    Thank you Edd! The is exactly what I was looking for, there should be a detailed list for what every type does.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] [Plugin: Custom Field Template] Add text box if previous is not null’ is closed to new replies.