Created
October 8, 2013 15:59
-
-
Save csknk/6886986 to your computer and use it in GitHub Desktop.
Add files for download as a ul. Refers to repeater field from the Advanced Custom Fields plugin for WordPress. Hook code is for the Thesis 2.1 framework. For the repeater field "worksheets" and subfields "upload" (the file for download), "upload_title" (the title for the download link) and "filesize" (so that filesize can be displayed on the dow…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****ADD REPEATER FIELD FOR UPLOADED FILES****/ | |
function add_project_downloads() { | |
if(get_field('worksheets')): ?> | |
<h3 class="no_top_margin">Download Worksheets for this Lesson</h3> | |
<ul> | |
<?php while(has_sub_field('worksheets')): ?> | |
<li><a href="<?php the_sub_field('upload'); ?>"><?php the_sub_field('upload_title'); ?></a> (PDF, <?php the_sub_field('filesize'); ?>)</li> | |
<?php endwhile; ?> | |
</ul> | |
<?php endif; | |
} | |
add_action('hook_top_project_downloads', 'add_project_downloads'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment