Last active
August 29, 2015 14:24
-
-
Save MatRouault/be7756ac236da562bc9c to your computer and use it in GitHub Desktop.
Buddydrive in a Page Template
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
<?php | |
/* | |
Template Name: Documents | |
*/ | |
//* Remove Genesis Loop and Add Custom Loop Instead | |
remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); | |
add_action( 'genesis_entry_content', 'fcu_do_custom_loop' ); | |
/** | |
* Outputs custom post content | |
* | |
* @return void | |
*/ | |
function fcu_do_custom_loop() { | |
echo '<table class="category-table display responsive">'; | |
echo '<thead>'; | |
echo '<tr>'; | |
echo '<th>Titre du document</th>'; | |
echo '<th>Description</th>'; | |
echo '<th>Auteur</th>'; | |
echo '<th>Date</th>'; | |
echo '<th>Type</th>'; | |
echo '<th>Télécharger</th>'; | |
echo '</tr>'; | |
echo '</thead>'; | |
echo '<tbody>'; | |
// The Query | |
if ( buddydrive_has_items( buddydrive_querystring() ) ): | |
$buddydrive_args = array( | |
'buddydrive_scope' => public, | |
'type' => buddydrive_get_file_post_type(), | |
); | |
while ( buddydrive_has_items ( $buddydrive_args ) ) : buddydrive_the_item(); | |
echo '<tr>'; | |
echo '<td><strong>'. buddydrive_get_item_title() .'</strong></td>'; | |
echo '<td>'. buddydrive_get_item_description() .'</td>'; | |
echo '<td>'. buddydrive_get_owner_or_cb() .'</td>'; | |
echo '<td>'. buddydrive_get_item_date() .'</td>'; | |
echo '<td>'. buddydrive_get_item_mime_type() .'</td>'; | |
echo '<td><a class="button small" href="'. buddydrive_get_action_link() .'">Télécharger</a></td>'; | |
echo '</tr>'; | |
endwhile; | |
endif; | |
echo '</tbody>'; | |
echo '</table>'; | |
} | |
//* Remove the footer | |
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 ); | |
remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); | |
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 ); | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment