Created
August 6, 2015 17:48
-
-
Save arelthia/b5f4f93f36fcd1fff8bc to your computer and use it in GitHub Desktop.
Genesis Custom Pods Archive template
This file contains hidden or 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
| remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
| add_action( 'genesis_loop', 'tht_book_archive_custom_loop' ); | |
| /** | |
| * Genesis custom loop | |
| */ | |
| function tht_book_archive_custom_loop() { | |
| $books = new Pod('book'); | |
| $params = array( | |
| 'order' => 'ASC', | |
| 'orderby' => 'title', | |
| 'paged' => get_query_var( 'paged' ) | |
| ); | |
| $cnt = 0; | |
| $books->findRecords($params); | |
| if($books->total()>0){ | |
| echo "<h2 style='padding-bottom:40px;'>All Books:</h2>"; | |
| while($books->fetch()){ | |
| $cnt = $cnt+1; | |
| if ( 0 == $cnt % '3' ) { | |
| $firstclass = 'first'; | |
| } | |
| printf( '<article class="entry %s one-third" itemscope="itemscope" itemtype="http://schema.org/CreativeWork">',$firstclass); | |
| ?> | |
| <div class="entry-content"> | |
| <?php | |
| printf( '<div><a href="%s" rel="bookmark" title="Click for more info"><img src="%s" alt="%s" class="aligncenter" /></a></div>', $books->display('permalink') , $books->display('book_cover_image._src.large'), the_title_attribute( 'echo=0' ) ); | |
| ?> | |
| </div> | |
| <header class="entry-header"> | |
| <p itemprop="headline"> | |
| <a href="<?php echo $books->display('permalink'); ?>" rel="bookmark"> | |
| <?php echo $books->display('post_title'); ?> | |
| </a> | |
| </p> | |
| </header> | |
| </article> | |
| <?php | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment