• Resolved handers

    (@handers)


    In the forum there are several related Q&A to this topic, though I cannot find a way to make it work for me. I’m using the free “Station” (PageLines)theme.

    What I want is a few categories (with Id-numbers 4, 43) to display the posts in reverse order (oldest first).

    There are several lines of php-code in the forum, though I do not understand where to paste them.
    There’s an editor that gives access to the Station-theme – in the right-column there are many possible templates that can be edited – among those, one called _posts.php seems the most logical to alter or add, though I’m at a loss as to where; php, coding in general, is largely mystery to me.

    Can anyone guide me step by step?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    What theme template files to edit depends on what theme you are using. Usuallly this would be category.php or archive.php. What theme are you using?

    Moderator keesiemeijer

    (@keesiemeijer)

    I see it’s a premium theme. Have you asked their forums: https://www.pagelines.com/forum/

    Thread Starter handers

    (@handers)

    thanks for your reply;

    I use the free version of Station – apparently one has to pay to join their forums, which is something I cannot afford;

    neither “category.php” nor “archive.php”, or anything that looks like it, is listed in the possibilities to edit – sofar I’ve not been able to detect which template (if any) is responsible for the individual posts to be “categorised” – I’ve looked at the files on the server, but they are even more abracadabra to me…

    I’m even willing to abandon “Station” for a lookalike, if that solves my problem, although I do like the design

    Moderator keesiemeijer

    (@keesiemeijer)

    Yes I think you have to edit _posts.php
    something like this before the loop:

    <?php
    if(is_category('4') || is_category('43')){
    query_posts('order=ASC');
    }
    ?>
     <!-- The Loop -->
    <?php if (!is_404() && have_posts()) : while (have_posts()) : the_post(); // Start of the loop ?>

    Thread Starter handers

    (@handers)

    thanks again for your answer;

    something happened allright: I have also a category id=8 – when I pasted the code you offered into the _posts.php-template

    (like this quote:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    both categories 4 and 43 displayed category 8, and that was in reverse order.

    I conclude the beginning’s there, though I’d highly appreciate some more help

    Moderator keesiemeijer

    (@keesiemeijer)

    That is strange indeed. Is this an older version of the “Station theme”? Your code of the loop is different than what I have, or have you altered it? Is category 8 a sub-category? Will try this on my server.

    Moderator keesiemeijer

    (@keesiemeijer)

    Ok I tried it and couldn’t get a normal query_posts to work. Remove the code from _posts.php and try it with this in functions.php:

    function my_custom_posts_order( &$q ) {
        if ( $q->is_archive ) {
          if(in_array($q->query_vars['cat'], array(4,43))){
            $q->set( 'order', 'ASC' );
          }
        }
        return $q;
      }
      add_filter('parse_query', 'my_custom_posts_order');

    Thread Starter handers

    (@handers)

    thanks again for all your trouble;

    theme-version is 1.2.1. & I would not dare alter the code – I know nothing about php; I’ve never updated the theme (if any update should have been made available) – I do like the design & functions as is;

    sorry, I do not detect a “functions.php” template which can be edited through the editor;

    not sure how paste-bin works, but I pasted the content of the _posts.php under this link:

    Thread Starter handers

    (@handers)

    no, 8 is not a subcategory;

    before I started this discussion I tried following on the _pagecontent.php:
    <?php if (is_category(array(4,43))){
    query_posts($query_string . “&order=ASC”);} ?>
    above this line:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    and that gave no result whatsoever

    Moderator keesiemeijer

    (@keesiemeijer)

    A that’s why we have different files, my version is Station 2.1.2. Can you put your functions.php in a pastebin and link back here.

    Thread Starter handers

    (@handers)

    sorry, there is no functions.php

    Thread Starter handers

    (@handers)

    I’m not sure why there’s no reaction anymore – sofar I’ve updated the Station theme to 2.1.2. and tried again the code above the loop, but that returned even a more messy result than in the old one (meanwhile I’ve switched back to version 1.2.1.)

    like I’ve stated before I’m willing to abandon the station-theme for another, should that provide a better result in displaying reverse order in specific categories

    I’d hate to get rid of WordPress altogether, because it has so many positive features, but I do need to display a story I’m working on in the correct chronological order (which is oldest first)
    I’m still hoping that can be done with the help of the editor (and without a separate course in php-coding)

    Moderator keesiemeijer

    (@keesiemeijer)

    Thread Starter handers

    (@handers)

    excellent, that works fine indeed;

    after installing the plugin is found under Settings->CustomPostOrder and allows the order to define from as Date, Title, Author, LastModified or PostName (the post slug) and then to choose from each category individually, to ascend or descend, just as I wanted;

    thank you so much!

    Moderator keesiemeijer

    (@keesiemeijer)

    You’re welcome. Glad you got it resolved.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Category – reverse order’ is closed to new replies.