WordPress.org

Ready to get started?Download WordPress

Forums

Help Make Nicer Archives Default To Categories Vie (9 posts)

  1. phpNeophyte
    Member
    Posted 10 years ago #

    I installed Mark's modified Codegurl’s nicer archives I'm trying to make it so the default view (when you first go there) is sorted by category rather than by Month.
    I tried to change the default listing by categories by changing
    $defaultorderby = ‘category’;
    $defaultorder = ‘DESC’;
    Then finding this line:
    function show_orderby_select() {
    global $orderby;
    and added this right below it:
    if ($defaultorderby) $orderby = $defaultorderby;
    That didn't do it. Can anyone give me a heads up on how to accomplish this? The code is here: http://dinki.mine.nu/weblog/b2-img/narchives.phps
    My implementation is here: http://organicgardensite.com/narchives.php
    Thanks.
    Kevin

  2. Laughinglizard
    Member
    Posted 10 years ago #

    I am sorry that I have not been able to address this sooner, but here is an option.
    The reason that the date is the default is because that is the way WordPress takes care of default sorting. In order for the archives to be sorted by category automatically, you will have to make 2 changes.
    1) Modify the Sorted Archives link to look like this: http://organicgardensite.com/narchives.php?orderby=category
    2) Find this line in narchives.php:
    if ($HTTP_POST_VARS["orderby"] == 'category') {
    and replace it with this:
    if ($orderby == '') $orderby = $HTTP_POST_VARS["orderby"];
    if ($orderby == 'category') {
    HTH and again, sorry for the delay.
    Peace

  3. phpNeophyte
    Member
    Posted 10 years ago #

    Hey no worries at all Mark, I was just trying to see if anybody else had made a similar modification (didn't want to bug you.)
    Hmmm, that works except that I lose the category label above the results. Before, if I sorted on category I got the name of the category above the articles now I get the results but no category "Label"
    Kevin

  4. Laughinglizard
    Member
    Posted 10 years ago #

    :-) No worries.
    The second change was to make sure the category labels worked. I am having trouble recreating this on my server (due to different configurations).
    Would you try adding:
    global $orderby;
    before the:
    if ($orderby == '') $orderby = $HTTP_POST_VARS["orderby"];
    if ($orderby == 'category') {
    and see if that helps?

  5. phpNeophyte
    Member
    Posted 10 years ago #

    Added it, didn't change the behaviour.
    Kevin

  6. phpNeophyte
    Member
    Posted 10 years ago #

    Mark,
    If you click on the link to all archives from the forum http://organicgardensite.com/forum/ (didn't change the sorted archives link there) you see the date header. Then when you sort it to "categories" it used to put the category header where the date header initially was. Now it sorts but the category header is not there. Just thought I'd make that clearer so you would understand what is happening now. Thanks.
    Kevin

  7. Anonymous
    Unregistered
    Posted 10 years ago #

    Has there been any more follow-up on this? I am getting the same result with these changes as phpNeoPhyte... Want to default to the exact look that you get from choosing "Categories" and "Ascending"... Any ideas?

  8. phpNeophyte
    Member
    Posted 10 years ago #

    I changed over to MtDewvirus archives hack so the links in my previous posts are bad now, sorry about that.
    Kevin

  9. andrew_h
    Member
    Posted 10 years ago #

    I came up with something that works for me (categories as default)
    http://wordpress.org/support/10/6041#post-23
    You can see it working at
    http://www.andrew-hall-artist.com/journal/narchives.php
    It may not be the best method, I am sure Mark will have it sorted soon. No it does not nest subcategories.
    [My categories will be a untidy today anyway as I am reorganising my structure].
    Andrew

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.