WordPress.org

Ready to get started?Download WordPress

Forums

124

Sortable nicer archives for WordPress 1.2 (96 posts)

  1. Laughinglizard
    Member
    Posted 10 years ago #

    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 copy the file to the root of your blog and create a link from your index.php.

  2. Mark (podz)
    Support Maven
    Posted 10 years ago #

    Got mine working now too :)
    (I had to select sort by year, I had nothing appear)

  3. Kyramas
    Member
    Posted 10 years ago #

    Thanks man !
    Its a great piece of work !!!
    You just have to add a closing "/" to some of the "input type" thingies so it can validate as XHTML.
    But of course its a minor detail !!!
    Thanks again.
    Your work is greatly appreciated.

  4. randybrown
    Member
    Posted 10 years ago #

    Nice mod, LaughingLizard! Thanks for sharing. I installed and got it working in about 5 minutes. A question or two:
    What is the purpose/use of the additional "single" style sheet? I had to set the $single var to 0 to get it to pick up my default style sheet. How are you intending the use of two style sheets with this?
    Any way to limit the listing to just the current year? The user can choose to list other years, but can I set the default to just the current?
    Thanks again.
    <rb>

  5. Laughinglizard
    Member
    Posted 10 years ago #

    @randybrown and others:
    Fixed the validation issue.
    I have removed the $single check from the new download. Please download again if you would like. The $single is used to load different stylesheets on my blog when permalinks are clicked. :-) Sorry.

  6. crow_t_autobot
    Member
    Posted 10 years ago #

    Thanks for the slick archive LL. Plugged it in, and it works great.

  7. andrew_h
    Member
    Posted 10 years ago #

    Additional thoughts - it would be great to make the links from the index.php page offer the main sort options right there eg:
    Archives
    by category
    by date
    etc
    Would using query-string links work - just tried
    http://www.andrew-hall-artist.com/journal/narchives.php?orderby=category&asc_desc=ASC&m=2004&author=andrew
    didn't work but maybe I've made a stupid mistake. Alternatively, probably better, I can make a couple of different versions, narchivescat, narchivesdate and set different defaults.
    Andrew

  8. randybrown
    Member
    Posted 10 years ago #

    Beel: Where do I need to place the statement? I tried placing it in show_year_select(). The current year was in fact selected, but the listing still include previous years.

  9. Beel
    Member
    Posted 10 years ago #

    I stuck it here:
    if (!($_POST["submit"])) { $m = date('Y'); }
    //Make sure categories get parsed out, they are deprecated in wp-blog-header.php
    if ($_POST["orderby"] == 'category') {
    http://www.billhayes.us/wordpress/narchives.php
    and I am working on getting it as an include in the index page:
    http://www.billhayes.us/wordpress/archives

  10. randybrown
    Member
    Posted 10 years ago #

    LaughingLizard - Another mod for you:
    To better aling with .htaccess and mod-rewrte rules, I made the follow changes to archive_header:
    In the if ('date' == $orderby || empty($orderby)) structure, I changed $thisdate = $thisyear.$thismonth; to $thisdate = $thisyear.'/'.$thismonth; and $output .= '<br/><br/>'.$month[$thismonth].' '.$thisyear.''; to $output .= '<br/><br/>'.$month[$thismonth].' '.$thisyear.'';.
    In the } elseif ('category' == $orderby) { structure, I changed $ $thiscategory = $category_name; to $thiscategory = get_catname($category_name); and $output .= '<br/><br/>'.get_catname($thiscategory).'';
    to $output .= '<br/><br/>'.$thiscategory.'';
    .
    <rb>

  11. w8in
    Member
    Posted 10 years ago #

    Great mod! Thank you!

  12. randybrown
    Member
    Posted 10 years ago #

    I'm getting an error in my error logs:
    Cannot modify header information - headers already sent by
    This is getting printed twice each time I run the narchives file. Anyone know why this is occurring?
    <rb>

  13. Laughinglizard
    Member
    Posted 10 years ago #

    @randybrown:
    There was a filename at the end of that error. Please check that file to see if there is anything after the last ?> in that file.

  14. randybrown
    Member
    Posted 10 years ago #

    LL: It's the "narchives.php" file. I renamed it index.php for my purposes, but it's the same format as I originally downloaded from you. I have made some mods, as listed above, but even the original file gives the errors.
    Here's the full error msg:
    [Sun May 23 21:14:15 2004] [error] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/randy/public_html/blog/artifacts/index.php:6) in Unknown on line 0
    <rb>

  15. justkristin
    Member
    Posted 10 years ago #

    pjt:: I am getting the same error when sorting ascending, but not descending. No idea why, however.

  16. justkristin
    Member
    Posted 10 years ago #

    actually, pjt, for me I have figured out why it is sorting poorly, both ascending (in the beginning) and descending (in the end):
    For the most part, the list sorts just fine, but the few posts I had that had tags or special characters in the beginning are sorted by that character. I don't know with PHP how to parse this out....if it were Perl, maybe. Anyone figured out how to work around this?

  17. Michael Heilemann
    Member
    Posted 10 years ago #

    andrew_h, I tried using your mod for not listing a specific category, and it works fine when listing by category (where I wouldn't mind if it actually didn't exclude the category) and title. But for date sorting it doesn't work at all.
    http://binarybonsai.com/masterarchives

  18. Laughinglizard
    Member
    Posted 10 years ago #

    Im going to consider that the new "changes" are being handled between the originator and the user implementing those changes. If you cannot get something to work (even an extra change) please find me in #wordpress or email me and I will try to help out.
    Good job with helping out!

  19. geotay
    Member
    Posted 10 years ago #

    Parse error: parse error, unexpected T_VARIABLE in /home/public_html/narchives.php on line 42
    huh?

  20. andrew_h
    Member
    Posted 10 years ago #

    Hi Michael, no it wouldn't since my changes act in the $_POST["orderby"] == 'category' part of the loop, to make changes in the date sort you would need to make changes around line 260. There may also be better ways of doing what I did (like altering the database call). For the time being I am happy as things now are for me though I might look at altering the dates within category sort order sometime.
    Andrew

  21. randybrown
    Member
    Posted 10 years ago #

    Has anyone checked your server error logs to see if you are getting the Cannot modify header information msg I posted above? I want to confirm that this error is appearing only on my install.
    Thanks.
    <rb>

  22. Michael Heilemann
    Member
    Posted 10 years ago #

    Andrew, I don't know PHP at all, is there a chance I can get you to mock up the changes I need and perhaps mail them to me, or simply post them here?

  23. Anonymous
    Unregistered
    Posted 10 years ago #

    randy: No I am not getting header errors. I am getting database errors now that I have upgraded from the latest nightly however :-) "Where user_level > 0" and "invalid argument for foreach on line 62" - Just a heads up to those who keep up with the latest.

  24. southerngal
    Member
    Posted 10 years ago #

    Mark, thank you! :) You rock!

  25. andrew_h
    Member
    Posted 10 years ago #

    Hi Michael
    I'm pretty busy right now so can't help, sorry. If I get a chance later I will have another look but don't hold your breath :-)
    Andrew

  26. Anonymous
    Unregistered
    Posted 10 years ago #

    The database errors are because the table variables have changed in the new nightly builds...
    check the file wp-setting.php for the changes...

  27. Anonymous
    Unregistered
    Posted 10 years ago #

    Here's the new table variables in the new nightlies...
    $wpdb->posts = $table_prefix . 'posts';
    $wpdb->users = $table_prefix . 'users';
    $wpdb->categories = $table_prefix . 'categories';
    $wpdb->post2cat = $table_prefix . 'post2cat';
    $wpdb->comments = $table_prefix . 'comments';
    $wpdb->links = $table_prefix . 'links';
    $wpdb->linkcategories = $table_prefix . 'linkcategories';
    $wpdb->options = $table_prefix . 'options';
    $wpdb->optiontypes = $table_prefix . 'optiontypes';
    $wpdb->optionvalues = $table_prefix . 'optionvalues';
    $wpdb->optiongroups = $table_prefix . 'optiongroups';
    $wpdb->optiongroup_options = $table_prefix . 'optiongroup_options';
    $wpdb->postmeta = $table_prefix . 'postmeta';
    And here is the old variables from the 1.2 release...
    $tableposts = $table_prefix . 'posts';
    $tableusers = $table_prefix . 'users';
    $tablesettings = $table_prefix . 'settings'; // only used during upgrade
    $tablecategories = $table_prefix . 'categories';
    $tablepost2cat = $table_prefix . 'post2cat';
    $tablecomments = $table_prefix . 'comments';
    $tablelinks = $table_prefix . 'links';
    $tablelinkcategories = $table_prefix . 'linkcategories';
    $tableoptions = $table_prefix . 'options';
    $tableoptiontypes = $table_prefix . 'optiontypes';
    $tableoptionvalues = $table_prefix . 'optionvalues';
    $tableoptiongroups = $table_prefix . 'optiongroups';
    $tableoptiongroup_options = $table_prefix . 'optiongroup_options';
    $tablepostmeta = $table_prefix . 'postmeta';
    in the narchive.php file... just replace the old variables for the new ones in the sql statements and it should work...

  28. Anonymous
    Unregistered
    Posted 10 years ago #

    Just made the changes to the file and it works perfectly...
    For those of you running the new nightlies.. you can grab the modded version here, fixed to work with the new naming scheme of the tables...
    narchives 1.3alpha fix

  29. Anonymous
    Unregistered
    Posted 10 years ago #

    The only thing missing from this is pagination. That way you can list lets say the first 50 posts and a link would appear on the bottom for the rest...
    Or even better would be to list only a specific month with links to the other months...
    Great addition to wordpress either way!

  30. Anonymous
    Unregistered
    Posted 10 years ago #

    works great with one exception:
    Selecting DATE and or TITLE - if I have ALL YEARS selected it will display nothing, I HAVE TO select a YEAR to have posts show up.
    Selecting CATEGORY and have ALL YEARS selected, will display correctly.
    Further up in this thread I saw somebody commenting on needing to add something:
    if (!($_POST["submit"])) { $m = date('Y'); }
    - is this the problem? Do I need to add this someplace, and if yes, where?

124

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.