Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Applications
- */
- get_header(); ?>
- <div id="ppagewrapper" >
- <?php
- // if show all is set
- if( isset($_GET['showall']) ):
- $args = array( 'hide_empty' => 0 );
- else:
- // else show paged
- $page = ( get_query_var('paged') ) ? get_query_var( 'paged' ) : 1;
- // number of tags to show per-page
- $per_page = 5;
- $offset = ( $page-1 ) * $per_page;
- $args = array( 'number' => $per_page, 'offset' => $offset, 'hide_empty' => 0 );
- endif;
- $taxonomy = 'apptypes';
- $appterms = get_terms( $taxonomy, $args );
- foreach ($appterms as $appterm) {
- $termID = $appterm->term_id;
- $taxonomyName = $taxonomy;
- $termchildren = get_term_children( $termID, $taxonomyName );
- foreach ($termchildren as $child) {
- $termsub = get_term_by( 'id', $child, $taxonomyName );
- echo '<div style="margin:0 auto; width="100%"><h2>'. $appterm->name.'</h2></div>';
- echo $termsub->name;
- $wpq = array (
- 'taxonomy' => $taxonomy,
- 'term' => $termsub->slug
- );
- $query = new WP_Query ($wpq);
- $article_count = $query->post_count;
- echo '<table width="98%" border="0" cellspacing="0" cellpadding="5" class="customtable">
- <tr class="customhead">
- <td align="left" valign="top">Year</td>
- <td align="left" valign="top">Kit Name</td>
- <td align="left" valign="top">Kit</td>
- </tr>
- <tr><td colspan="3">'.term_description($termsub->term_id,$taxonomyName) .'</td></tr>';
- if ($article_count) {
- $posts = $query->posts;
- foreach ($posts as $post) {
- include(MY_THEME_FOLDER . '/appsloop.php');
- }
- }
- echo ' </table>';
- }}
- echo '<table width="980" ><tr><td>';
- // pagination
- // if showall isn't set
- if( !isset($_GET['showall']) ):
- $total_terms = wp_count_terms( 'apptypes' );
- $pages = ceil($total_terms/$per_page);
- // if there's more than one page
- if( $pages > 1 ):
- for ($pagecount=1; $pagecount <= $pages; $pagecount++):
- echo '<a href="'.get_permalink().'page/'.$pagecount.'/" style="padding:5px;">'.$pagecount.'</a> ';
- endfor;
- // link to show all
- echo '<a href="'.get_permalink().'?showall=true">show all</a>';
- endif;
- else:
- // showall is set, show link to get back to paged mode
- echo '<a href="'.get_permalink().'">show paged</a>';
- endif;
- echo '</td></tr></table>';
- ?>
- <?php
- //list terms in a given taxonomy
- /*$page = ( get_query_var('page') ) ? get_query_var( 'page' ) : 1;
- // number of tags to show per-page
- $per_page = 5;
- $offset = ( $page-1 ) * $per_page;
- $appargs = array( 'number' => $per_page, 'offset' => $offset, 'hide_empty' => 0 );
- $taxonomy = 'apptypes';
- $appterms = get_terms($taxonomy,$appargs);
- foreach ($appterms as $appterm) {
- $termID = $appterm->term_id;
- $taxonomyName = $taxonomy;
- $termchildren = get_term_children( $termID, $taxonomyName );
- foreach ($termchildren as $child) {
- $termsub = get_term_by( 'id', $child, $taxonomyName );
- echo '<div style="margin:0 auto; width="100%"><h2>'. $appterm->name.'</h2></div>';
- echo $termsub->name;
- $wpq = array (
- 'taxonomy' => $taxonomy,
- 'term' => $termsub->slug
- );
- $query = new WP_Query ($wpq);
- $article_count = $query->post_count;
- echo '<table width="98%" border="0" cellspacing="0" cellpadding="5" class="customtable">
- <tr class="customhead">
- <td align="left" valign="top">Year</td>
- <td align="left" valign="top">Kit Name</td>
- <td align="left" valign="top">Kit</td>
- </tr>
- <tr><td colspan="3">'.term_description($termsub->term_id,$taxonomyName) .'</td></tr>';
- if ($article_count) {
- $posts = $query->posts;
- foreach ($posts as $post) {
- include(MY_THEME_FOLDER . '/appsloop.php');
- }
- }
- echo ' </table>'; } }*/
- ?>
- </div>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement