If statements for fields within a Repeater
-
Hi there,
I have a group of fields, in this case to upload .doc and .pdf files. However, sometimes only one of them is available. Is it possible to detect weather a file has been added to the input field—and then show or hide elements based on that? I found some code from a different discussion, but it doesn’t seem to be working for me. Can anyone give me a hand?
<?php foreach( get_uf_repeater( 'upload' ) as $document_files ): extract( $document_files ) ?> <article class="row uploads"> <div class="col-xs-10 col-lg-11 clearfix"> <h4><?php echo $unitdoc_title ?></h4> <?php if( in_array( 'unitdoc_pdf', $document_files ) ): ?> <a href="<?php echo $unitdoc_pdf ?>" class="btn pdf">.PDF</a> <?php else : ?><?php endif?> <?php if( in_array( 'unitdoc_doc', $document_files ) ): ?> <a href="<?php echo $unitdoc_doc ?>" class="btn doc">.DOC</a> <?php else : ?><?php endif?> </div> </article> <?php endforeach ?>
Thanks.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘If statements for fields within a Repeater’ is closed to new replies.