Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/05/2011, 12:22
maximartin
 
Fecha de Ingreso: marzo-2010
Mensajes: 26
Antigüedad: 14 años, 1 mes
Puntos: 0
categoria en pagina

hola maestros, estuve investigando como insertar la lista de una categoria en una pagina. lo que hice fue crear una plantilla con el codigo del home (es del theme arras) con un comentario arriba del todo, asi:

Código PHP:
Ver original
  1. <?php
  2. /*
  3. Template Name: nombredelacategoria
  4. */
  5. ?>
  6. <?php get_header(); ?>
  7.  
  8. <?php
  9. $stickies = get_option('sticky_posts');
  10. rsort($stickies);
  11.  
  12. $slideshow_cat  = arras_get_option('slideshow_cat');
  13. $featured1_cat  = arras_get_option('featured1_cat');
  14. $featured2_cat  = arras_get_option('featured2_cat');
  15. $news_cat       = arras_get_option('news_cat');
  16.  
  17. $slideshow_count    = (int)arras_get_option('slideshow_count');
  18. $featured1_count    = (int)arras_get_option('featured1_count');
  19. $featured2_count    = (int)arras_get_option('featured2_count');
  20.  
  21. $post_blacklist = array();
  22. ?>
  23.  
  24. <div id="content" class="section">
  25. <?php arras_above_content() ?>
  26.  
  27. <?php if (!$paged) : ?>
  28.  
  29.  
  30. <?php if ( $featured1_cat !== '' && arras_get_option('enable_featured1') ) : ?>
  31. <?php arras_above_index_featured1_post() ?>
  32. <!-- Featured Articles #1 -->
  33. <div id="index-featured1">
  34. <?php if ( arras_get_option('featured1_title') != '' ) : ?>
  35.     <div class="home-title"><?php _e( arras_get_option('featured1_title'), 'arras' ) ?
  36.  
  37. ></div>
  38. <?php endif ?>
  39.  
  40.     <?php
  41.     $query2 = arras_parse_query($featured1_cat, $featured1_count, array_unique
  42.  
  43. ($post_blacklist), arras_get_option('featured1_posttype'), arras_get_option
  44.  
  45. ('featured1_tax'));
  46.     arras_render_posts( apply_filters('arras_featured1_query', $query2),
  47.  
  48. arras_get_option('featured1_display'), arras_get_option('featured1_tax') );
  49.     ?>
  50. </div><!-- #index-featured1 -->
  51. <?php endif; ?>
  52.  
  53. <?php if ( $featured2_cat !== '' && arras_get_option('enable_featured2') ) : ?>
  54. <?php arras_above_index_featured2_post() ?>
  55. <!-- Featured Articles #2 -->
  56. <div id="index-featured2">
  57. <?php if ( arras_get_option('featured2_title') != '' ) : ?>
  58.     <div class="home-title"><?php _e( arras_get_option('featured2_title'), 'arras' ) ?
  59.  
  60. ></div>
  61. <?php endif ?>
  62.     <?php
  63.     $query3 = arras_parse_query($featured2_cat, $featured2_count, array_unique
  64.  
  65. ($post_blacklist), arras_get_option('featured2_posttype'), arras_get_option
  66.  
  67. ('featured2_tax'));
  68.     arras_render_posts( apply_filters('arras_featured2_query', $query3),
  69.  
  70. arras_get_option('featured2_display'), arras_get_option('featured2_tax') );
  71.     ?>
  72. </div><!-- #index-featured2 -->
  73. <?php endif; ?>
  74.  
  75. <?php if ( arras_get_option('enable_news') ) : ?>
  76. <?php arras_above_index_news_post() ?>
  77. <!-- News Articles -->
  78.  
  79. <div id="index-news">
  80. <?php if ( arras_get_option('news_title') != '' ) : ?>
  81. <div class="home-title"><?php _e( arras_get_option('news_title') ) ?></div>
  82. <?php endif ?>
  83. <?php
  84. $news_query = arras_parse_query($news_cat, ( (arras_get_option('index_count') == 0 ?
  85.  
  86. get_option('posts_per_page') : arras_get_option('index_count')) ), array_unique
  87.  
  88. ($post_blacklist), arras_get_option('news_posttype'), arras_get_option('news_tax'));
  89.  
  90. $news_query['paged'] = $paged;
  91.  
  92. query_posts( apply_filters('arras_news_query', $news_query) );
  93. arras_render_posts( null, arras_get_option('news_display'), arras_get_option('news_tax') );
  94.  
  95. ?>
  96. <?php if(function_exists('wp_pagenavi')) wp_pagenavi(); else { ?>
  97.     <div class="navigation clearfix">
  98.         <div class="floatleft"><?php next_posts_link( __('Older Entries', 'arras')
  99.  
  100. ) ?></div>
  101.         <div class="floatright"><?php previous_posts_link( __('Newer Entries',
  102.  
  103. 'arras') ) ?></div>
  104.     </div>
  105. <?php } ?>
  106.  
  107. </div><!-- #index-news -->
  108. <?php arras_below_index_news_post() ?>
  109. <?php endif; ?>
  110.  
  111. <?php $sidebars = wp_get_sidebars_widgets(); ?>
  112. <div id="bottom-content-1">
  113.     <?php if ( isset($sidebars['sidebar-4']) ) : ?>
  114.     <ul class="clearfix xoxo">
  115.         <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Bottom Content
  116.  
  117. #1') ) : ?>
  118.         <li></li>
  119.         <?php endif; ?>
  120.     </ul>
  121.     <?php endif; ?>
  122. </div>
  123.  
  124. <div id="bottom-content-2">
  125.     <?php if ( isset($sidebars['sidebar-5']) ) : ?>
  126.     <ul class="clearfix xoxo">
  127.         <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Bottom Content
  128.  
  129. #2') ) : ?>
  130.         <li></li>
  131.         <?php endif; ?>
  132.     </ul>
  133.     <?php endif; ?>
  134. </div>
  135.  
  136. <?php else: ?>
  137.  
  138. <div class="home-title"><?php _e('Latest Headlines', 'arras') ?></div>
  139. <?php query_posts('category_name=fabio') ?>
  140.  
  141. <div id="archive-posts">
  142.     <?php arras_render_posts(null, arras_get_option('archive_display')) ?>    
  143.  
  144.     <?php if(function_exists('wp_pagenavi')) wp_pagenavi(); else { ?>
  145.         <div class="navigation clearfix">
  146.             <div class="floatleft"><?php next_posts_link( __('Older Entries',
  147.  
  148. 'arras') ) ?></div>
  149.             <div class="floatright"><?php previous_posts_link( __('Newer
  150.  
  151. Entries', 'arras') ) ?></div>
  152.         </div>
  153.     <?php } ?>
  154. </div><!-- #archive-posts -->
  155.  
  156. <?php endif; ?>
  157.  
  158. <?php arras_below_content() ?>
  159. </div><!-- #content -->
  160.    
  161. <?php get_sidebar(); ?>
  162. <?php get_footer(); ?>
  163.  
  164. para que me llame a la lista tendria que insertar esta query donde comienza el loop:
  165.  
  166. <?php query_posts('category_name=nombredelacat') ?>

si alguien me ayuda a visualizar el loop donde debo insertar la query le agradeceria. graciiass

Última edición por metacortex; 27/05/2011 a las 12:16 Razón: Etiquetar código