Wordpress Help with archives page.

This is a discussion on "Wordpress Help with archives page." within the Web Page Design section. This forum, and the thread "Wordpress Help with archives page. are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jun 17th, 2008, 11:32
Resources Team
Join Date: Jun 2007
Location: UK
Posts: 453
Thanks: 1
Thanked 4 Times in 4 Posts
Wordpress Help with archives page.

Hi all,

Sorry I didn't know where to place this topic, because could resolve around a number of matters, but it comes down to a wordpress help I need, maybe we should create a wordpress, or any other CMS forum? this would be handy.

Anyway back on topic, I want an archives page to look similar to this:

http://veerle.duoh.com/blog/archives/

Yes, I am aware that this isn't used for wordpress, but I still want this affect, so I have install a plugin and created my archives page, but I don't know where in the PHP I can edit to change it to add a little javascript to get a similar affect. It doesn't have to be complicated, just with a basic tab system would do. Below is my code that I have so far, and I will attach a screenshot of the page so far, so could someone please advise where? and how to add this affect?

PHP: Select all

<?php
/*
Plugin Name: Smart Archives
Version: 1.9.2
Plugin URI: http://justinblanton.com/projects/smartarchives/
Description: A simple, clean, and future-proof way to present your archives.
Author: Justin Blanton
Author URI: http://justinblanton.com
*/
function smartArchives($format='both'$catID='') {
    global 
$wpdb$PHP_SELF;
    
setlocale(LC_ALL,WPLANG); // set localization language
    
$now gmdate("Y-m-d H:i:s",(time()+((get_settings('gmt_offset'))*3600)));  // get the current GMT date
    
$bogusDate "/01/2001"// used for the strtotime() function below 
 
 
$yearsWithPosts $wpdb->get_results("
     SELECT distinct year(post_date) AS `year`, count(ID) as posts
     FROM $wpdb->posts 
     WHERE post_type = 'post' 
     AND post_status = 'publish' 
     GROUP BY year(post_date) 
     ORDER BY post_date DESC"
);
 
 foreach (
$yearsWithPosts as $currentYear) {
  
  for (
$currentMonth 1$currentMonth <= 12$currentMonth++) {
   
   
$monthsWithPosts[$currentYear->year][$currentMonth] = $wpdb->get_results("
   SELECT ID, post_title FROM $wpdb->posts 
   WHERE post_type = 'post'
   AND post_status = 'publish' 
   AND year(post_date) = '$currentYear->year' 
   AND month(post_date) = '$currentMonth'   
   ORDER BY post_date DESC"
);
  }
 }
 
 if ((
$format == 'both') || ($format == 'block')) { // check to see if we are supposed to display the block
  
  // get the shortened month name; strftime() should localize
     
for($currentMonth 1$currentMonth <= 12$currentMonth++) $shortMonths[$currentMonth] = ucfirst(strftime("%b"strtotime("$currentMonth"."$bogusDate")));
  
  if (
$yearsWithPosts) {
   foreach (
$yearsWithPosts as $currentYear) {
    
    
    for (
$currentMonth 1$currentMonth <= 12$currentMonth++) {
     
     if (
$monthsWithPosts[$currentYear->year][$currentMonth]) echo ('<a href="'.get_month_link($currentYear->year$currentMonth).'" class="another_month">'.$shortMonths[$currentMonth].'</a> ');
     else echo 
'<span class="emptymonth">'.$shortMonths[$currentMonth].'</span> ';
     
    }    
    echo 
'<br/>';
   }   
   echo 
'<br /><br />';  
  } 
 }
 
 if ((
$format == 'both') || ($format == 'list')) { //check to see if we are supposed to display the list
  
  // get the month name; strftime() should localize
        
for($currentMonth 1$currentMonth <= 12$currentMonth++) $monthNames[$currentMonth] = ucfirst(strftime("%B"strtotime("$currentMonth"."$bogusDate")));
  
  if (
$yearsWithPosts) {
   
   if (
$catID != '') { // at least one category was specified to be excluded
       
       
$catIDs explode(" "$catID); // put the category(ies) into an array
       
foreach($yearsWithPosts as $currentYear) {
        
        for (
$currentMonth 12$currentMonth >= 1$currentMonth--) {
         
         if (
$monthsWithPosts[$currentYear->year][$currentMonth]) {
             echo (
'<h2><a href="'.get_month_link($currentYear->year$currentMonth).'">'.$monthNames[$currentMonth].' '.$currentYear->year.'</a></h2>');
             echo 
'<ul>';
          
          foreach (
$monthsWithPosts[$currentYear->year][$currentMonth] as $post) { 
              
              if (
$post->post_date <= $now) {
                  
$cats wp_get_post_categories($post->ID);
                  
$found false;
                  
                  foreach (
$cats as $cat) if (in_array($cat$catIDs)) $found true;
                                 
                                 if (!
$found) echo ('<li><a href="'.get_permalink($post->ID).'class="theselinks">'.$post->post_title.'</a></li>');
                             } 
                         }   
          echo 
'</ul>';  
            }
           }
       }
      }
      
      else { 
// we don't need to exclude any categories
      
          
foreach($yearsWithPosts as $currentYear) {
        
        for (
$currentMonth 12$currentMonth >= 1$currentMonth--) {
         
         if (
$monthsWithPosts[$currentYear->year][$currentMonth]) {
          echo (
'<h2><a href="'.get_month_link($currentYear->year$currentMonth).'class="theselinks">'.$monthNames[$currentMonth].' '.$currentYear->year.'</a></h2>'); 
          echo 
'<ul>';
          
          foreach (
$monthsWithPosts[$currentYear->year][$currentMonth] as $post) echo ('<li><a href="'.get_permalink($post->ID).'class="theselinks">'.$post->post_title.'</a></li>');
          echo 
'</ul>';
         }
        }
       }
      }             
  }
 }
?>
Thanks for your help
Craig
Attached Images
File Type: jpg d.jpg (20.8 KB, 3 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Page wordpress!? crackafaza Webforumz Cafe 2 Apr 16th, 2008 02:15
Using wordpress posts in a static page marSoul Scripts and Online Services 11 Jan 25th, 2008 15:42
Monthly Archives using PHP/MySQL? Jack Franklin PHP Forum 9 Jan 12th, 2008 21:15
Palace Archives thepalace1 Free Web Site Critique 0 Apr 4th, 2007 17:20


All times are GMT. The time now is 18:12.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42