Forums

Codex: Displaying post by Catagory id order (2 posts)

  1. davidjackson
    Member
    Posted 6 years ago #

    I was looking at the Codex for sorting post by title.
    So I've added the following lines to the theme index.php
    And added category_ID to below. But I seem to be missing something?

    Tia,
    David Jackson

    <?php get_header(); ?>

    <?php
    // we add this, to show *all* posts sorted
    // alphabetically by title
    $posts = query_posts($query_string . '&orderby=category_ID&order=asc&posts_per_page=-1');
    // here comes The Loop!
    if (have_posts()) : while (have_posts()) : the_post(); ?>

  2. davidjackson
    Member
    Posted 6 years ago #

    Ok,
    It tried changing query line to this:

    $posts = query_posts($query_string . '&orderby=post_category&order=desc&posts_per_page=-1');

    But keep getting this error:

    Parse error: parse error, unexpected $ in /www/t/thegatheringcf/htdocs/wordpress/wp-content/themes/Test/index.php on line 47

    tia,
    David

Topic Closed

This topic has been closed to new replies.

About this Topic