elroy81
Member
Posted 3 years ago #
Hi i have a soccer site http://www.footballkitsonline.com and on the home page i have a list of teams listed under the Title 'English Teams'. They are in alphabetical order but every time i try to add a new team for example Hull City the post is listed above Arsenal. Is there a way i can reorder the teams?
<h2>English Clubs</h2>
<?php $recent = new WP_Query("cat=1&showposts=16"); while($recent->have_posts()) : $recent->the_post();?>
<b>" rel="bookmark"><?php the_title(); ?></b>
<?php endwhile; ?>
This is the current code.
Thanks
You should be able to add "orderby=title" to your query. Try that.
elroy81
Member
Posted 3 years ago #
Hi thanks for the response. Where would i add this in the code? Sorry im quite new to all this.
You posted this query:
WP_Query("cat=1&showposts=16");
and Otto said: add to your query. So, make it another parameter in that query... &orderby=title
elroy81
Member
Posted 3 years ago #
Thanks that sort of worked. If i was to add say Hull City it would be in the correct order. The only prob i have now is the teams are listed from the bottom up, instead of the top down.
Bolton Arsenal
Blackburn Instead of Aston Villa
Aston Villa Blackburn
Arsenal Bolton
Any ideas?
Thanks for your help so far.
elroy81
Member
Posted 3 years ago #
Sorry
Bolton
Blackburn
Aston Villa
Arsenal
Instead of
Arsenal
Aston Villa
Blackburn
Bolton
Add order=ASC to it as well.
elroy81
Member
Posted 3 years ago #
Thanks Otto42 and moshu. That works a treat!
Much Appriciated.
mangal_pandey1
Member
Posted 3 years ago #
I simply caught hold of this wonderful plugin Default Sort Ascend by Dennis Steed :D
Now my posts are older first..
Check here: http://hostingwebsitecoupons.com
Cheers,
KD