SHARE
TWEET

Addition to "Date Based Category Archives for Wordpress"

a guest Feb 1st, 2011 558 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $anho_actual = (get_query_var('year')) ? get_query_var('year') : 0;
  3. $mes_actual = (get_query_var('monthnum')) ? get_query_var('monthnum') : 0;
  4.  
  5. if ($anho_actual == 0 || $mes_actual == 0)
  6. {
  7.         $anho_actual = date("Y");
  8.         $mes_actual = date("m");
  9.        
  10.         global $query_string;
  11.        
  12.         $query_string .= "&year=".$anho_actual."&monthnum=".$mes_actual;
  13.         query_posts($query_string);
  14.                
  15. }
  16.  
  17. $anho_previo = $anho_actual;
  18. $anho_proximo = $anho_actual;
  19.  
  20. $categoria = get_cat_ID(  get_query_var('category_name') );
  21.  
  22. $category_link = get_category_link( $categoria );
  23.  
  24. $mes_previo = $mes_actual - 1;
  25.  
  26. if ($mes_previo == 0)
  27. {
  28.         $mes_previo = 12;
  29.         $anho_previo = $anho_actual - 1;
  30. }
  31.  
  32. $mes_proximo = $mes_actual + 1;
  33.  
  34. if ($mes_proximo == 13)
  35. {
  36.         $mes_proximo = 1;
  37.         $anho_proximo = $anho_actual + 1;
  38. }
  39.  
  40. $dummy_date = strtotime($anho_actual."-".$mes_actual."-1");
  41. ?>
  42.  
  43. <div id="nav">
  44.  
  45. <div class="prev"><h1><a href="<?=$category_link;?><?=$anho_previo;?>/<?=$mes_previo;?>">&lt;</a></h1></div>
  46.  
  47. <div class="mes"><h1><?=strftime("%b", $dummy_date);?><span><?=strftime("%Y", $dummy_date);?></span></h1></div>
  48.  
  49. <div class="next"><h1><a href="<?=$category_link;?><?=$anho_proximo;?>/<?=$mes_proximo;?>">&gt;</a></h1>
  50. </div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top