post-page

Sortable Nicer Archives for WordPress

83
responses
by
 
on
May 23rd, 2004
in
WordPress Hack

I redid and reworked the Nicer Archives for WordPress. The archives list can be sorted by date and category and filtered by author and year. All of the functions, as far as I tested, are working.

The example archives are here:
http://mindfulmusings.net/weblog/narchives.php

Download php file from here:
http://weblogtoolscollection.com/b2-img/narchives.phps

The install is really simple. Just rename the downloaded file to narchives.php and copy it to the root of your blog and create a link from your index.php.

heading
heading
83
Responses

 

Comments

  1. Jeremy Higgs (3 comments.) says:

    Hi!

    I’m trying to download the narchives.phps file, but when I download it, all I get is a file with a ton of br and font tags… It seems that formatting has been applied to the PHP script. Is there any other way I can get the script?

    Thanks a lot!

  2. Mark says:

    The code should be covered in
    tags etc. I am not sure what you are looking at. However, if after you copy and paste the code, it still does not work, I will send you the code in another format.

  3. Jeremy Higgs (3 comments.) says:

    Hi!

    Here’s a snippet of the code that I get when I try and get the page source for the .phps file (I get the same downloading it with wget and then viewing it):


    `<?php require('wp-config.php'); $single = 1; $siteurl = get_settings('siteurl'); ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head profile="http://gmpg.org/xfn/1">`

    There are br and font tags everywhere, which seem to interfere with the actual PHP code. (I enclosed the code in backticks… Hopefully that works.)

    Any ideas?

    Thankyou very much!

  4. Jeremy Higgs (3 comments.) says:

    Ummm… OK, that IS weird. There were br and font tags everywhere when I pasted it. Something must have happened to it when I posted the comment. Is there any chance I could get someone to email a plaintext copy to me?

    Thanks!

  5. PlanetPhillip (3 comments.) says:

    Hi,
    Thanks for a great hack that is easy to install.
    I would like to change the order within a category by name. At the moment when I filter by category there doesn’t seem to be any discernible order, not date, name or post ID.

    I’ve looked throught the code but am not smart enough to know where to look.

    The exact code is here:
    http://www.planetphillip.com/narchives.phps

    TIA
    Phillip

  6. Mark says:

    Find these lines in the narchives.php file:
    <code>
    //Make sure categories get parsed out, they are deprecated in wp-blog-header.php
    if ($_POST["orderby"] == ‘category’) {
    global $author, $m;
    $orderby = ‘category’;
    if ($_POST["order"] == ”) $order = “DESC”;
    </code>

    and reaplce them with:
    <code>
    //Make sure categories get parsed out, they are deprecated in wp-blog-header.php
    if ($_POST["orderby"] == ”) $_POST["orderby"] = ‘category’;
    if ($_POST["orderby"] == ‘category’) {
    global $author, $m;
    $orderby = ‘category’;
    if ($_POST["order"] == ”) $order = “ASC”;
    </code>

  7. Ingrid (1 comments.) says:

    This is a great script thanks !

  8. Mark (34 comments.) says:

    Are you sure you are putting it in the right place?

  9. Cyskon says:

    Hi there, your archive will not read my CSS file, it just displays the information as a normal page without even looking at my CSS.

    HELP! I would really like to implement your plugin.

    Thanks

  10. Ruby Sinreich (1 comments.) says:

    Hi I’ve installed this and it’s been working fine. However, it recently changed it’s behavior.

    It used to be that when I loaded the nice archive, I got a list of all the site’s posts and the menus to sort/select them. Now when I load it, it shows no posts until I select and sort. And it won’t show “all years,” only one or the other of the years in my archive.

    Any ideas about what might have caused this change?

  11. Ryan (1 comments.) says:

    This script is great. Got a question though. How can I set it so sort by category is the default. I tried changing the $defaultorderby but it did nothing. thanks in advance

  12. SEbasic (1 comments.) says:

    Hi there,
    I know you don’t have to provide any support for this hack, But I was wondering if you could let me know why this error message keeps apperaring when I try to view narchives.php

    Fatal error: Cannot redeclare show_year_select() (previously declared in /home/softalie/public_html/narchives.php:59) in /home/softalie/public_html/narchives.php on line 58

    I have been trying to re skin the plugin (To no avail it appears).
    Any ideas what would cause this error? (Clearly my messing around has caused this, I just don’t know what I could have done).

    Thanks very much.

    Oliver

  13. Henriette (5 comments.) says:

    … ended up using podz’ narchives2.php, here: http://wordpress.org/support/topic.php?id=15653

    Thanks!

  14. Henriette (5 comments.) says:

    Very nice – but there’s a bug, and I don’t know how to fix it. I’ve been all over the code but I can’t find where to insert the relevant clause (AND where $date < $today):

    If you select Category and set the year to the current one (2005, right now) you get as yet unpublished articles. This does not happen with Title or Date. (It’s not relevant if you don’t write posts in advance, but it’s a show-stopper if you do.)

    Next, there’s only one author for my blog. Commenting out the relevant author_select function and function calls is easy – but perhaps this could be made into an option?

    A smaller bug: changing the $defaultorder = ‘DESC’; to $defaultorder = ‘ASC’; doesn’t work, that is, the default sort order remains DESC. (That’s not the browser cache – I tried it with Moz and Firefox.)

    (And I’d really like the “title” to show the short post blurb (wp_posts.post_exerpt) instead of repeating the post title, but that’s a very minor thing.)

    Many thanks for this plugin, minor faults and all!

  15. Henriette (5 comments.) says:

    … that got cut off. The bug is: if you have as yet unpublished posts, they get shown if you select category and current year (2005, right now). It’s of no consequence if you don’t write things in advance, but it’s a showstopper if you do – and I can’t find where to insert that “and where $date smallerthan $today”.

    A minor bug, as posted earlier: changing the defaultorder to ‘ASC’ doesn’t work.

    An even smaller niggle: I have no need for the author select (and in fact it shows all registered blog users … not just authors). It’s easy to comment out the author_select function and function calls, but perhaps showing author_select at all should be an option, not a default thing?

    And a very minor niggle: I’d like the “title” (the mouseover hint) for a post to show wp_posts.post_excerpt, not a repeat of the post title.

    Thanks for a nice script, minor bugs and all!

  16. Lorelle (7 comments.) says:

    BUG

    On my site at http://www.cameraontheroad.com.....chives.php I’m having a very strange bug. When nice archives is sorted by date, everything is fine, but when I sort by category (only change to sort), look under category “life on the road” and there begins a bunch of duplicate entries for the same post. Life on the Road is the default category and I’ve triple-checked and these are only single posts (no duplicates) and they are listed without duplicates when sorted by date. Not every post is duplicated, so maybe there is something about these individual posts, but I can’t find anything. No special keys, nothing. Ideas?

  17. Mark says:

    Are they in more than one category? If they are, they will show up uynder both categories.

  18. Jonathan says:

    Hi there,
    I am trying to find way to change the defaults on this. I’d like Catagory and ASC to be the default sort options.
    I’ve seen plenty of messages all over the place that talk about how to change these defauts but I’ve found nothing that actually conclussively describes how to do it in a way that works.

    Can you tell me how? Would certainly appreciate it.

    Thanks

  19. markusz says:

    Hi

    I have added a call to my sidebar (that I would like to have on the left side) as the second statement in the narchives.php body:

    < ?php get_sidebar(); ?>

    this produces the folowing warning at the top of the narchives.php, otherwise narchives works fine:

    Warning: extract() [function.extract]: First argument should be an array in
    wordpress/wp-includes/functions.php on line 1733

    This is the relevant line from functions.php:
    extract($wp_query->query_vars);

    require_once($file);
    }

    Additionally, entries where I have edited the post date or are deleted also show up on the narchies page. How can I get rid of them?

    Any help is very much appreciated!

  20. Lorelle VanFossen (7 comments.) says:

    That wasn’t the issue. Having the same post show up twice in the same category is different than having one post in different categories. It is still doing the same thing. Hasn’t been fixed yet.

    I’m upgrading everything to 1.5 and the version for that, narchives2, is working fine. Very odd.

  21. Lorelle VanFossen (7 comments.) says:

    Tried this several times and couldn’t get it to work. Any other ideas? I’m using on version 2 of nicer archives.

  22. Jonathan Greene (12 comments.) says:

    not sure what I did wrong… followed the directions, but just get a page of code…

    http://www.atmasphere.net/wp/narchives.phps

  23. Mark (58 comments.) says:

    I am so sorry! I should have been more clear and I will fix the tutorial. Rename the dowloaded file to narchives.php and go from there. :) sorry again

  24. Siuyee says:

    Firebird added a bunch of HTML codes to narchives.phps when I chose “save link to disk” :???:, had to copy and paste to a new file (narchives.php) manually.

    Hope that helps.

  25. Jonathan Greene (12 comments.) says:

    OK – Did that… still getting code displayed… :cry:

    http://www.atmasphere.net/wp/narchives.php

  26. Mark (58 comments.) says:

    You’ve got mail. :)

  27. justkristin (3 comments.) says:

    I can’t seem to get past the following output:
    Fatal error: Failed opening required ‘blog.header.php’ (include_path=’.:/usr/local/lib/php’) in /nethome/www/justkristin/narchives.php on line 3
    Where did I go wrong? Thank you for this great script,
    and for helping with it. :)

  28. Gary says:

    Mark, I have the same problem as Jonathan.

  29. justkristin (3 comments.) says:

    Actually, my install works now. No idea how I changed it, though. Now I am only having the ascending sort issue (random). thank you for a wonderful plugin!

  30. justkristin (3 comments.) says:

    Sorry I am not coherent enough to keep all my stuff in one comment. :) I just realized what is messing up the sort – either way, now that I look at it. The few posts that have titles beginning with some kind of special character get sorted by the character…
    I’d offer a solution if the thing were in Perl, but I am hopelessly lost in PHP land. Is there some way to use regexp to parse out non-alpha characters at the beginning of the string?

  31. Gary says:

    copy and pasting the code solved my problem. Thanks Siuyee

  32. Geoff Taylor says:

    I’m getting this error:
    Parse error: parse error, unexpected T_VARIABLE in /home/public_html/narchives.php on line 42

  33. Mark (58 comments.) says:

    Geoff,
    Right click on the phps file and save it as a .php file. There should not no parse error at line 42.

  34. Eric (1 comments.) says:

    I have a problem with the date sort. It will only show the month of December for descending sorts and only show the month of January for ascending sorts. Any ideas? Thanks for the nicer archives and thank is advance for any help.

  35. markus says:

    If I use narchives & post per page plugin (http://rephrase.net/miscellany/05/perpage.phps ) together narchives reports the following error:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1]
    SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND post_date_gmt

  36. markus says:

    If I use narchives & post per page plugin (http://rephrase.net/miscellany/05/perpage.phps ) together narchives reports the following error:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1]
    SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND post_date_gmt ’2005-02-27 14:04:59′ AND (post_status = “publish”) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 5-1

    If I deactivate post per page plugin narchives works fine. This is the only thing I change. Can anyone help?
    Thanks

  37. Enrique Espinosa says:

    You seem to have a profound understanding on the powers of the Sort. What is the easiest way to change my archive page to always sort by alpha of title of post.

    Currently using WP 1.5.

    Running WP as a really simple CMS and if I can solve this little problem, I’m golden.

    Any help would be REALLY appreicated, I’m busting head trying to figure out how to do something really easy. Can’t believe this isn’t a standard option.

  38. Gary (1 comments.) says:

    I am having the same problem with the weird “-1 at line 1″ error and also use the post per page plugin. Had not thought about that being the culprit. Wish someone had figured out the problem not sure I am capable.

  39. Steve says:

    This is a great program, but seems to have a lot of sorting bugs; ascending/descending are mixed up, sorting by date leaves out many entries, etc. Is the author alive? I’d love to fix these problems :(

  40. Steve says:

    It occurs to me this might be an issue with using permalinks. Possible?

  41. Steve says:

    Is the dev alive?

  42. Andre Bell (1 comments.) says:

    Howdy all,

    How do I make narchives sort by title as default instead of by date? I tried experimenting by changing $defaultorderby = ‘post_date’; to post_title but that obviously didn’t work (I just tried guessing since I don’t do any programming).

    If you know the answer please send me an email at http://www.andrebell.com/contact.html or post here if weblogtools automatically notifies of replies.

    Thank you very very much!!!

    btw, I’m using narchives at http://www.economicbooster.com/blog/narchives.php

  43. archshrk (2 comments.) says:

    After fixing the css path and adding the get header/footer functions my sitemap looks like any other part of my site except… along the top is a warning.

    Warning: extract(): First argument should be an array in /www/a/archshrkcom/htdocs/wp-includes/functions.php on line 1813

    But I don’t know what’s wrong. Any thoughts?

  44. Jonathan (2 comments.) says:

    Hi there. Is it possible to change what the default sort is? Namely, I’d like it to show everything sorted by category by default. The user can then change it from that if they wish.
    Also, does this support WP1.5.x theming? I have the default Kubrick theme and want to insure this will use that.
    Thanks…Jonathan

  45. Jackie (1 comments.) says:

    I can’t seem to figure out how to have the archives appear on a page formatted like my theme. Narchives appears to “break” it. I have tried many things including the default installation & also changing the wp-layout.css to the path of my theme’s css. Neither work.
    Look here: http://www.thebellsite.com/blog/narchives.php
    If you’ve got ideas or suggestions drop me a line at jbell2k@hotmail.com – Thanks!

  46. IdeoBook says:

    I have used Sortable Nicer Archives for a long time. It works well in WP 1.*. But after upgrade to 2.0, it returns some errors:
    ——————
    WordPress database error: [Unknown column 'user_level' in 'where clause']
    SELECT * FROM wp_users WHERE user_level > 0
    Warning: Invalid argument supplied for foreach() in /home/…/archives.php on line 74
    ——————

    The related codes are:
    ——————
    function show_author_select() {
    global $wpdb, $tableusers, $author;
    $users = $wpdb->get_results(“SELECT * FROM $tableusers WHERE user_level > 0“, ARRAY_A);
    $output .= ‘All Authors’.NL;
    foreach ($users as $user) {
    $output .= ”.$user['user_nickname'].”.NL;
    }
    $output = ”.NL.$output.”.NL;
    echo $output;
    }
    ——————
    Can Mark or anybody help me to solve this problem?
    Thank you!

  47. Christina (1 comments.) says:

    WordPress database error: [Unknown column 'user_level' in 'where clause']
    SELECT * FROM wp_users WHERE user_level > 0

    Warning: Invalid argument supplied for foreach() in /home/nic10001/public_html/investmentoption.org/blog/narchives.php on line 89

    Take a look:
    http://www.investmentoption.org/blog/narchives.php

    Can you fix this? It works fine in wordpress 1.5.2 but when I upgraded
    to 2.0 this is the problem I get.

  48. Karen Kreps (1 comments.) says:

    I’m trying to setup narchives.php on 1riccie.com/ideas (so a link to it appears in the sidebar.php). I’m a novice and would like to ask for more detailsa about how to include a link to /narhives.php from index.php (or sidebar.php). I’ve searched all over wordpress for instructions and have had no success. Hope you can please help!

  49. Mike Smullin (1 comments.) says:

    If you just want to sort posts in category view by title rather than by date, then here’s a quick and easy way to do that:

    mikesmullin.com/2006/05/23/wordpress-plugin-sort-category-posts-by-title/

  50. Diane Vigil (1 comments.) says:

    So, was narchives ever upgraded for WordPress 2.x?

  51. oyun indir (1 comments.) says:

    So, was narchives ever upgraded for WordPress 2.x?

  52. dizisaati (1 comments.) says:

    Hi there, your archive will not read my CSS file, it just displays the information as a normal page without even looking at my CSS.

    HELP! I would really like to implement your plugin.

    Thanks

  53. dizisaati (1 comments.) says:

    I’m trying to setup narchives.php on 1riccie.com/ideas (so a link to it appears in the sidebar.php). I’m a novice and would like to ask for more detailsa about how to include a link to /narhives.php from index.php (or sidebar.php). I’ve searched all over wordpress for instructions and have had no success. Hope you can please help!

  54. bedava oyunlar (1 comments.) says:

    Thanks for a nice script, minor bugs and all!

  55. msn (1 comments.) says:

    I am having the same problem with the weird “-1 at line 1? error and also use the post per page plugin. Had not thought about that being the culprit. Wish someone had figured out the problem not sure I am capable.

  56. Dizi (1 comments.) says:

    It occurs to me this might be an issue with using permalinks



Trackbacks/Pingbacks

  1. [...] use of a few plugins and some code that isn’t mine. You can find the plugins here, and the sortable archives is here.) Posted in Binary [...]

  2. [...] カテゴリー: WordPress お知らせ — juso @ 04:08

    Mark氏の「Nicer Archivesã€ã‚’ä½¿ã£ã¦ã€æœˆåˆ [...]

  3. [...] 2004/9/25 Saturday nicer archive Filed under: WordPress – admin @ 14:33 Nicer Archives¤òƳÆþ¤·¤Æ¤ß¤ë¡£¤¦¤Þ¤¯¤¦¤´¤¯¤«¤Í¤§¡Ä ¤ [...]

  4. [...] 221; goes out to the people who made the following: Faked Folders Search Hilite MarkDown Sortable Archives Thumb-in-Post View Levels WP-Amazon [...]

  5. [...] doing Utility Fog and posting playlists and some commentary there). I adapted these from Nicer Archives and the various WordPress included php [...]

  6. [...] Weblog tools blog tools blogging tools WordPress Hack — Podz Mark produced Sortable Nicer Archives for WordPress but sometimes p [...]

  7. [...] 221; goes out to the people who made the following: Faked Folders Search Hilite MarkDown Sortable Archives Thumb-in-Post View Levels WP-Amazon [...]

  8. Betalogue says:

    [...] olution for Nicer Archives mod problem [Blogging]

    Well, Mark Ghosh, the author of the Nicer Archives mod discussed earlier today, did get b [...]

  9. [...] , and right now, I guess minimalism. There’s now an archive listing, tricked up with nicer archives, as well as a couple of other things, [...]

  10. [...] ; Filed under: WordPress Hacks | 6:05 pm {} Mark at Weblog Tools Collection has an WP archives hack to gi [...]

  11. WP Hack: Nicer Archives
    Mark at Weblog Tools Collection has a WP archives hack to give you a sortable list of archives. You can sort on date and category and filter by author and year. I have it in use here at Blogging Pro.

  12. WordPress/FAQ/Sortable Nicer Archive¤ò»ÈÍѤ·¤¿¤¤
    freeze uid:2 aid:0 gid:0 Sortable Nicer Archive¤ò»ÈÍѤ·¤¿¤¤ WordPress¤ÎÁ´µ­»ö¤Î¥¿¥¤¥È¥ë¤ò¡¢¡ÖÆüÉաס֥«¥Æ¥´¥ê¡×¡Ö¥¿¥¤¥È¥ë¡×¤Ê¤É¤Î¥­¡¼¤ò»ØÄꤷ¤ÆʤÙÂؤ¨¤Æɽ¼¨¤·¤Æ¤¯¤ì¤ë¡¢Sortable Nicer Archive¤¬Benjamin¤µ¤ó¤Î¼ê¤Ë¤è¤Ã¤ÆXOOPS´Ä¶­¤Ç¤â»ÈÍѽÐÍè¤ë¤è¤¦¤Ë¤Ê¤…

  13. CLA STYLE says:

    Nicer ArchivesƳÆþ
    Nicer Archives¤òƳÆþ¤·¤Æ¤ß¤Þ¤·¤¿¡£

  14. archives and homepages
    things are getting better and better with WP – touch wood! – i’ve been meaning to put in place a better way IMHO to go through the archives

    it’s in already! click on the title ‘archives’ from my menu and it will give you the list of all posts s…

  15. Renovations In Place
    Been working on this site the last few days.

    First up there’s the comments popup page which is coming out… not quite well. Did a few things to it, and it’s now a little more presentable, but I’m still kinda sick with the header messing around a…

  16. [...] ;at 2005 三月 9 星期三 @ 4:44 pm Rate this post: 原始文章在國外 : Sortable Nicer Archives for WordPress [...]

  17. [...] りあえずはこんなもんか。 あ、あと過去ログがわかりやすいようにSortable Nicer Archives for WordPressを導入。 こ [...]

  18. [...] dant.

    Nice Archives
    Want a table of contents that is sortable. Nice Archives create [...]

  19. [...] ndant. Nice Archives Want a table of contents that is sortable. Nice Archives create [...]

  20. [...] ¤¬¥ê¥ó¥¯¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£ °Ê²¼¤Ë»ä¤ÎÀßÃÖ¼ê½ç¤ò¥á¥â¤·¤Æ¤ª¤­¤Þ¤¹¡£ Weblog Tools Collection¤è¤ênarchives.phps¤ò£Ä£Ì¤·¡¢narchives.php¤Ë¥ê¥Í¡¼¥à¸åWP S [...]

  21. [...] s の投稿内容をすべて表示” rel=”category tag”> — yutaka @ 23:58:25 narchives.phpというプラグインを見つけた [...]

  22. Sortable Nicer Archives

    テーマを変えたものの、アーカイブリストがイマイチ納得いかなかったので、WP関連のページをうろうろしてみたところ、110’s blogさんで使われている Sortable Nicer Archives for WordPressが便…

  23. [...] I’ve been playing around with WordPress 2.x, which has some enhancements from earlier versions (including usability enhancements) — but found that the wonderful Weblogtoolscollection.com “narchives” Site Map has not been updated to work with WP2.x. [...]

  24. [...] I am terribly sad that Narchives has not yet (to my knowledge) been updated to work with WP2.0.x. Narchives was short for “Nicer [...]

  25. [...] script needs a slight revamp. The closest php file I could find containing the code, was located at Mark Ghosh’s entry in weblog tools collection. You can see a text version of the file [...]

  26. [...] Sortable WordPress Archives Sortable Nicer Archives for WordPress [...]

  27. [...] I blog, I want to do certain things with my blog. When I first started with WordPress, my Sortable Nicer Archives plugin (please do not use it, it has gone by the wayside) was a necessity for me because I wanted a [...]

Obviously Powered by WordPress. © 2003-2013

page counter
css.php