Guest User

twenty-ten category.php with media-categories plugin

a guest
Feb 1st, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. <?php
  2. /**
  3. * The template for displaying Category Archive pages. Modifed for media categories output.
  4. *
  5. * @package WordPress
  6. * @subpackage Twenty_Ten
  7. * @since Twenty Ten 1.0
  8. */
  9.  
  10. get_header(); ?>
  11.  
  12. <div id="container">
  13. <div id="content" role="main">
  14.  
  15. <h1 class="page-title"><?php
  16. printf( __( 'Category Archives: %s', 'twentyten' ), '<span>' . single_cat_title( '', false ) . '</span>' );?></h1>
  17.  
  18.  
  19.  
  20.  
  21.  
  22. <?php if(is_category('member-entries')) {
  23. get_template_part( 'loop', 'category' );
  24.  
  25. }
  26.  
  27.  
  28. if(is_category('media-categories')) { ?>
  29.  
  30. <?php
  31. $args = array(
  32. 'post_type' => 'attachment',
  33. 'numberposts' => -1,
  34. 'post_status' => null,
  35. 'post_parent' => $post->ID,
  36. 'cat' => 17
  37. );
  38.  
  39. }
  40.  
  41.  
  42. if(is_category('landscape-2')) { ?>
  43.  
  44. <?php
  45. $args = array(
  46. 'post_type' => 'attachment',
  47. 'numberposts' => -1,
  48. 'post_status' => null,
  49. 'post_parent' => $post->ID,
  50. 'cat' => 15
  51. );
  52.  
  53. }
  54.  
  55. if(is_category('botanical-2')) {
  56.  
  57. $args = array(
  58. 'post_type' => 'attachment',
  59. 'numberposts' => -1,
  60. 'post_status' => null,
  61. 'post_parent' => $post->ID,
  62. 'cat' => 14
  63. );
  64.  
  65. }
  66.  
  67.  
  68.  
  69.  
  70. $attachments = get_posts($args);
  71.  
  72.  
  73.  
  74. if ($attachments) {
  75.  
  76.  
  77.  
  78. foreach ( $attachments as $attachment ) {
  79.  
  80. echo "<div class='post_class'>\n";
  81. // Start one post
  82.  
  83.  
  84.  
  85. $author_id=$attachment->post_author;
  86.  
  87. echo '</br>';
  88.  
  89. echo apply_filters(
  90. 'the_title' , $attachment->post_title );
  91.  
  92. echo '</br>';
  93.  
  94. the_attachment_link( $attachment->ID , false );?>
  95.  
  96. </br>
  97.  
  98. <?php
  99. $curuser = get_userdata($author_id);
  100. $author_post_url=get_author_posts_url($curuser->ID, $curuser->nicename);
  101. echo ' by <a href="' . $author_post_url . '" title="' . sprintf( __( "Posts by %s" ), $curuser->display_name ) . '" ' . '>' . $curuser->display_name.'</a>';?>
  102.  
  103. <p>
  104. From the entry:
  105.  
  106. <a href="<?php echo get_permalink($attachment->post_parent); ?>"><?php echo get_the_title($attachment->post_parent); ?></a>
  107. </p>
  108.  
  109.  
  110.  
  111. </div><!-- End of post_class -->
  112.  
  113.  
  114.  
  115.  
  116. <?php } //end foreach ?>
  117.  
  118.  
  119. <?php } //endif ?>
  120.  
  121.  
  122.  
  123.  
  124.  
  125. </div><!-- #content -->
  126. </div><!-- #container -->
  127.  
  128. <?php get_sidebar(); ?>
  129. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment