WordPress.org

Support

Support » How-To and Troubleshooting » alphabetical posts

alphabetical posts

  • Hi,

    I’ve looked around the forum, as well as in the documentation, but didn’t find it, so I’m asking here.

    How can I make my posts to be sorted alphabetically on my index – i.e. I want my posts to sort not by date, but by the name of the title of the post.

    Thanks in advance.

Viewing 15 replies - 16 through 30 (of 30 total)
  • I think there’s an error in the Codex, shouldn’t there be a closing
    ?>
    in the example for Alphabatizing posts under the heading “Category Template”?

    I found I needed to put that.

    When I use this to order search results I get broken next and previous buttons. They don’t do anything, and I can only see the first page of posts.

    I’ve been using the custom query string plugin http://mattread.com/archives/2005/03/custom-query-string-plugin/ for a week and it seems to do this.

    works well, but still doesn’t solve the problem of broken navigation on tag search results pages listed alphabetically

    jwurster, if I could reach you I would HUG YOU!!!!

    I’ve been pulling my hair out all afternoon when I finally had enough entries in my categories to see/realize that the category pages weren’t paginating correctly, and removing the alphabetizing code solved the problem (but didn’t look the way I wanted).

    That plug was exactly what I needed, and lets me keep my hair intact. 😉

    Thank you, thank you, thank you, thank you, THANK YOU! 😀

    This is exactly what I need to do… Just what this thread talks about, BUT on a PAGE not on a Category or Index. When I try this on a Page (Archives Template), the result is a list of pages not a list of posts. Anyone know what to do?

    kirkir wrote:

    I need to be able to list all the posts on my wordpress blog in alphabetical order (regardless of the categories each post is in). Meaning, I need to devise a page or some place where visitors to my site can see a list of all the posts in the blog alphabetically, like an index.

    Anyone with any helpful ideas on how to accomplish this?

    How about this ?

    Create a default category called Alphabetical.

    Every post will end up in this category, even if you’re half-asleep 🙂

    Link to this Alphabetical category, where you can order the posts alphabetically as described above.

    I want to alphabetize ALL my posts. I want to retain category information, so I don’t want to use only a specific category solution.

    When I add this code (from http://codex.wordpress.org/Alphabetizing_Posts):

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

    to my index.php file for my theme, I get a blank page.

    Suggestions?

    p.s. – by blank page, I mean that my entire blog disappears.

    If someone would please help with this I would really appreciate it.

    Per the code in the excellent plugin by Mike Smullin

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

    you can place this before your query and it will sort by post title

    <?php add_action(‘pre_get_posts’,’sort_categories_by_title’);

    function sort_categories_by_title($x) {
    if(is_category()) {
    $x->query_vars[‘orderby’] = ‘title’;
    $x->query_vars[‘order’] = ‘ASC’;
    }
    }
    ?>

    If you install the plugin, all your category displayed posts will be alphabetical… by putting it just in the category templates where you want that sorting… you can keep the other categories date based.

    Seems to work for me.

    Does this not work with sortby=post_name? I’m listing artists and have full names for post titles but last names for slugs since I was hoping to use post_name to sort (i.e. sort by last name but display full names with the title) but it’s not working.

    I have my posts Alphabetized, but I was wondering if there is a way to have the first word ignored if it is “the” So a post tittled “The Car” would be in the C’s. Any suggestions would be great. Thank you.

    anyone?

    In addition to the techniques described above to sort a Category by A-B-C-D…

    I am also now using the WP-Snap plugin to auto-generate an index list for each letter, all the posts that start with “A”, with “B”, with “C”….

    http://www.nateomedia.com/wares/downloads/wordpress/wp-snap/

    bmasterflash, with this plugin you can exclude stop-words like “the”!

Viewing 15 replies - 16 through 30 (of 30 total)
  • The topic ‘alphabetical posts’ is closed to new replies.
Skip to toolbar