[Plugin: Simple Fields] to help others with using simplefields
-
This is how to use simplefields for download links
<?php $selected_values = simple_fields_get_post_group_values(get_the_id(), "Download link", false,2); foreach($selected_values as $value){; echo '<div class="downloadtitle">' .( $value[4] ). '</div>'; echo '<a href="' .wp_get_attachment_url( $value[2] ). '">'.( $value[1] ).'</a>'; }?>
what’s going on here?
This is a simplefields repeatable group which consists of a download title such as “download our brochure below”, a download title which is the actual link text and a link to the attachment.the 3 values are the meta data which simple fields generates.
value 1 is a text field
value 2 is a file upload
value 3 is a text fieldAdditionally, separate from simplefields, you can add file icons by using css code similar to this
a[href$=’.doc’], a[href$=’.DOC’], a[href$=’.docx’], a[href$=’.DOCX’] {
background:transparent url(/images/MIcrosoft-icon.png) center left no-repeat;
display:inline-block;
padding-left:25px;
line-height:18px;
}This will add icons next to your links without the need for javascript.
I get alot of resources from the internet and I am extremely grateful for those who write and share code. I hope this helps others.
- The topic ‘[Plugin: Simple Fields] to help others with using simplefields’ is closed to new replies.