Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

Alphabetize posts in a category


 
Prev Previous Post   Next Post Next
  #1  
Old Mar 22, 2009, 03:29 PM
paulae's Avatar
paulae
 
1,333 posts · Feb 2009
Wordpress 3.4.1, Atahualpa 3.7.7
Alphabetize posts in a category

I want to have a category called Local Businesses, and I've used AZ-Index (wonderful plugin!) to create an index of categories of businesses, like Accountants, Clothing, Landscapers, etc. I made a text widget for the left sidebar using the index, only showing on the Business category. In addition, I pasted a list of accountants into a post called Accountants, another list into Clothing, etc.

Now, when you click on the Local Businesses link in the category menu, you are shown the most recent post, which is Dentists, because I put that in after Accountants. You can see it here: http://larchmontgazette.com/wp27/category/biz/

I found in the Wordpress codex (http://codex.wordpress.org/Alphabetizing_Posts) a way to alphabetize the output within a category, using a custom template. I created my-businesses-template.php, and put in their code (in red) thusly:

Code:
<?php
/*
Template Name Posts: My Businesses Template
*/
?>

<?php 
global $options; 
foreach ($options as $value) { 
	if (get_option( $value['id'] ) === FALSE) { 
		$$value['id'] = $value['std']; 
	} else { 
		$$value['id'] = get_option( $value['id'] ); 
	} 
}
if ( is_page() ) { global $wp_query; $current_page_id = $wp_query->get_queried_object_id(); }
?>
<?php get_header(); ?>
<?php // If there are any posts:
$posts = query_posts($query_string . 
'&orderby=title&order=asc&posts_per_page=-1');

if (have_posts()) : $postcount == 0; ?>
It's not working. Dentists is still showing up ahead of Clothing, Accountants, etc.

What am I doing wrong? Is it some difference between your index.php, which I used to make my-biz-template.php and the standard WP single post code?

Last edited by paulae; Mar 22, 2009 at 04:04 PM.
 

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Category menu to show the category posts in the dropdown gjchandler Page & Category Menu Bars 5 Aug 16, 2009 04:42 AM
thumbnails for all category posts and searches veenublue Atahualpa 3 Wordpress theme 2 Apr 30, 2009 01:05 PM
Static pages with category posts? mcphoto Atahualpa 3 Wordpress theme 3 Apr 25, 2009 09:48 AM
Posts showing up twice on category pages? michiganbasketball Atahualpa 3 Wordpress theme 1 Mar 12, 2009 04:56 PM
abbreviated posts on category page matty5490 Excerpts, Read more, Pagination 2 Feb 5, 2009 08:24 AM


All times are GMT -6. The time now is 05:41 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.