gaoluinn

scríbhinní ⁊ deocháin do chuallucht na Gaelainne

Músgraí Ord Postaí ar Leathanaigh Chatagóra WP — A Plug-in to Control the Order in Which Posts are Listed on Category Pages

Author: Mícheál Ó Lochlainn, Áras Shorcha Ní Ghuairim, Acadamh na hOllscolaíochta Gaeilge, Ollscoil na hÉireann, Gaillimh.

Published: 2nd March 2016.

An leathanach so à Gaelainn.

Keywords

WordPress, plug-in, dashboard, posts, alphabetical order.

Introduction

There's not much to say about this plug-in.

Out of the box, WordPress lists posts on category pages in chronological order. This makes perfect sense when it is being used as a blogging platform or to publish content where the order of creation is the same as the most useful order of access.

But WordPress is used for all kinds of Web publications and outside of blogging, alphabetical order is probably a much handier (and commoner) way to list entries. Músgraí Ord Postaí ar Leathanaigh Chatagóra WP makes it do that.

Músgraí Ord Postaí sa Deais WP

This plug-in is, effectively, the half-twin of the Músgraí Ord Postaí sa Deais WP plug-in, which does exactly the same thing only it does it in the website's Dashboard rather than in the public view. There's a good chance that if you want one you'll probably want the other.

Credit where it is due

All the credit for this plug-in's functionality goes to the authors of the WordPress Codex, which is where the important bits of the code came from.

All I'm after doing is pouring these into the framework of a plug-in. The original code was published under GPLv2 and, in accordance with the Ts and Cs, I make my own modifications available under the same licence.

Download Músgraí Ord Postaí ar Leathanaigh Chatagóra WP

Install Músgraí Ord Postaí ar Leathanaigh Chatagóra WP

Just extract the músgraí-ord-postaí-leathanaigh-chatagóra-wp directory from the tar.gz or zip file, upload it to the WordPress plug-ins directory, activate as normal and that's it. There's no settings and no control panel.

Reverse-alphabetical order

There's only one file in this plug-in: músgraí-ord-postaí-leathanaigh-chatagóra-wp.php. If reverse-alphabetical order is what you're after, and you're comfortable doing minor fiddling under the bonnet, go to line 50 and change $query->set('order','ASC'); to $query->set('order','DESC');.