Support » Plugins » New Archive Structure

  • I’ve been working on a new archive structure (similar to these) and would like some feedback and testing help.
    Things to note:
    1) This requires the use of the new permalinks structure and mod_rewrite, if there is a way to do it without these two, don’t ask me. 😉
    2) Single day and single post archives still use index.php.
    3) All other archives (including category archives) use a file I’ve created.
    4 The mod_rewrite rules have been modified to allow for 2 and 3 above.
    5) If a date or category isn’t passed to the archives, a list of categories and archives are displayed.
    6) You can click on months and years in the archives to drill down to another archive.
    7) Clicking on a day number, post title, or comment link will send you to index.php and display the appropriate post(s).
    That’s all I can think of for right now. I need to setup a test blog with the default WP install to test this out and make some modifications to the CSS. Once everything is working well, I’ll release the code.
    All feedback is welcome!

Viewing 15 replies - 31 through 45 (of 67 total)
  • permalink structure? wooo you just blew my mind..whats that?

    alright have done all that. as soon as I turn the hackfile on i get the following errors at the top of all the wp screens
    function archive_month($before=”, $after=”) { global $post, $previous_month, $month, $previous_day; $thismonth = mysql2date(‘m’, $post->post_date); $thisyear = mysql2date(‘Y’, $post->post_date); $thisdate = $thisyear.$thismonth; $output = ”; if ($thisdate != $previous_month) { if ($previous_month) { $output .= “\t\t
    \n”; } $thismonth = mysql2date(‘m’, $post->post_date); $output .= ‘
    ‘.$before.”.$month[$thismonth].’ ‘.$thisyear.”.$after.”\n”.’
    ‘; $previous_day = “”; $output .= “\n”; } $previous_month = $thisdate; echo $output; } function archive_day($before=”, $after=”) { global $post, $previous_day, $month; $thisday = mysql2date(‘j’, $post->post_date); $thismonth = mysql2date(‘m’, $post->post_date); $thisyear = mysql2date(‘Y’, $post->post_date); $thisdate = $thisyear.$thismonth.$thisday; $output = ”; if ($thisdate != $previous_day) { if ($previous_day) { $output .= “\t\t
    \n\t\n”; } $thisday = mysql2date(‘j’, $post->post_date); $thismonth = mysql2date(‘m’, $post->post_date); $output .= “\t”.’
    ‘; $output .= “\n”; } $previous_day = $thisdate; echo $output; } function get_year_link($year) { global $siteurl, $blogfilename, $querystring_start, $querystring_equal; if (!$year) $year = date(‘Y’, time()+($time_difference * 3600)); if (” != get_settings(‘permalink_structure’)) { $off = strpos(get_settings(‘permalink_structure’), ‘%year%’); $offset = $off + 7; $yearlink = substr(get_settings(‘permalink_structure’), 0, $offset); if (‘/’ != substr($yearlink, -1)) $yearlink = substr($yearlink, 0, -1); $yearlink = str_replace(‘%year%’, $year, $yearlink); $yearlink = str_replace(‘%post_id%’, ”, $yearlink); return $siteurl . $yearlink; } else { return $siteurl.’/’.$blogfilename.$querystring_start.’m’.$querystring_equal.$year; } }

    That’s unprocessed php code. Where did you put this, exactly? It should be in a file called my-hacks.php , and enclosed with <?php at the top and ?> at the bottom.

    wow don’t i feel stupid [lol]
    alright so have fixed that issue, but my arch is coming up very odd
    I just think I need to do some tweaking with the arch page

    I am also getting the issue where when i lick the title it brings me to theperma link but none of the images or css file can be found now due to the extra directories and such.
    any suggestions?

    I just emailed you back…
    Your file references are incorrect. The new permalink structure that you turned on causes the web server to “think” it needs to look in these folders for those files. You have some of your CSS and IMG references set to “../resource/ogham.css” or something similar. If you set these references to “/css file” or “/foldername/css file” (if in a folder), the web server will start looking from your “root” folder. Since the permalinks are turned on, this is what is happening:
    As an example…you are on page Your css references is “../resource/ogham.css”, which means, back up one folder and then look for a folder called resource and then the css file will be in there, so it’s looking the css file at, which of course does not exist. Try using “/…..”, you’ll be suprised! 😉

    ok so I have made the proper changes.
    but I am still having the issue with my arch page coming up very oddly
    any ideas?

    never mind solved it. I had wp starting twice for some reason

    I’ve modified the code to make it cleaner. It now uses only one function instead of two, since the two functions were always called one after the other and they used a lot of the same variables and code. This should speed it up (noticeably?…probably not much).
    If you were running the previous code:
    Remove the two functions archive_month and archive_day from your hacks file, replace with the new archive_date function.
    Remove the calls to these functions from arch.php and replace with a call to the new function.
    Updated Code

    See…I AM going blind! 😉 Thanks mamabean!

    Most welcome. 🙂

    Anything is possible in programming/software….but it would take some custom coding and I wouldn’t know where to begin. Anyone else have an idea?

    I decided in the end to have my poetry and stories in a separate installation of WP and keep the original one for my blog entries. That way I can make everything look just the way I want it to look. 🙂 I’m pleased that WP is so light and non-server-hogging that it doesn’t matter if you have to install it twice!
    Great hack though, I’m definitely going to use it for my blog’s master archive. Thanks!

    Hmm… I have a little problem here. I believe I did everything as I’m told, but my archives page ( and the permalinked entries aren’t showing any CSS properties. Arch.php (, however, is working great.
    Does anyone know why this is happening?

Viewing 15 replies - 31 through 45 (of 67 total)
  • The topic ‘New Archive Structure’ is closed to new replies.