Change loop order via form or link (jquery, not URL)

Why not do it via URL parameter? You said you can’t because Codex told you not to. But if you want to anyway, you could use a GET parameter:

// http://example.com/page-slug/?direction=DESC
if($_GET['direction'] == 'DESC'){
    $order="DESC";
} else {
    $order="ASC";
}

$args = array(
    ...
    ...
    'order' => $order,
);

Leave a Comment