Advertisement
Guest User

tagArchiveOrderByPostMeta

a guest
Nov 21st, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The template for displaying Tag pages
  4.  *
  5.  * Used to display archive-type pages for posts in a tag.
  6.  *
  7.  * @link http://codex.wordpress.org/Template_Hierarchy
  8.  *
  9.  * @package WordPress
  10.  * @subpackage Twenty_Thirteen
  11.  * @since Twenty Thirteen 1.0
  12.  */
  13.  
  14. get_header(); ?>
  15.  
  16.     <div id="primary" class="content-area">
  17.         <div id="content" class="site-content" role="main">
  18.  
  19.         <?php
  20.        
  21.             $tags_query = new WP_Query('orderby=meta_value&meta_key=post_tagorder_num&order=ASC');
  22.            
  23.         ?>
  24.        
  25.        
  26.         <?php if ($tags_query->have_posts() ) : ?>
  27.             <header class="archive-header">
  28.                 <h1 class="archive-title"><?php printf( __( 'Tag Archives: %s', 'twentythirteen' ), single_tag_title( '', false ) ); ?></h1>
  29.  
  30.                 <?php if ( tag_description() ) : // Show an optional tag description ?>
  31.                 <div class="archive-meta"><?php echo tag_description(); ?></div>
  32.                 <?php endif; ?>
  33.             </header><!-- .archive-header -->
  34.  
  35.             <?php /* The loop */ ?>
  36.             <?php while ( $tags_query->have_posts() ) : $tags_query->the_post(); ?>
  37.                 <?php get_template_part( 'content', get_post_format() ); ?>
  38.             <?php endwhile; ?>
  39.  
  40.             <?php twentythirteen_paging_nav(); ?>
  41.  
  42.         <?php else : ?>
  43.             <?php get_template_part( 'content', 'none' ); ?>
  44.         <?php endif; ?>
  45.  
  46.         </div><!-- #content -->
  47.     </div><!-- #primary -->
  48.  
  49. <?php get_sidebar(); ?>
  50. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement