Please or Register to create posts and topics.

Change ordering of posts/topics

PreviousPage 2 of 3Next

Hello @tomtom

Why you not just change the ordering in Forum -> Structure? For each category you can add a numerical value in the “Order” input-field which is used to order your categories as you need.

newforum.top has reacted to this post.
newforum.top
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

I’ve now done this and to somewhat got it kinda fixed. However the drug of choice should be last and welcome to the tenah house should be 2nd… cannot seem to get this to happen with this method. I’m obviously doing this wrong. Any suggestions? Thanks so much. I also run this for on my site and have no issues, i even got a banner up on top, but i cannot seem to do that either. Admitting i am very rusty. I do apologize

Uploaded files:
  • Forum-Tenah-House-Recovery.png

My site where all is well…

Uploaded files:
  • Forums-–-Komodo-IT-Group-Creative-Design-Services.png

Ok, i found my error. Thank you, where should i post about the Banner at the top being added? You are a great help. My order for the 2nd cat was set at 60. All fixed.

Quote from Asgaros on January 24, 2017, 12:51 pm

The available filters allow you to change the odering of your posts and topics. Here are a few code-example which you have to add to your themes functions.php file if you want to use them.

Show newest posts first in topic

function custom_asgarosforum_filter_get_posts_order($order) {
  $order = 'p1.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_posts_order', 'custom_asgarosforum_filter_get_posts_order');
  1. function custom_asgarosforum_filter_get_posts_order($order) {
  2. $order = ‘p1.id DESC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_posts_order’, ‘custom_asgarosforum_filter_get_posts_order’);
function custom_asgarosforum_filter_get_posts_order($order) {
  $order = 'p1.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_posts_order', 'custom_asgarosforum_filter_get_posts_order');

 Show newest topics first in forum

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.id DESC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

 Show oldest topics first in forum

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.id ASC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

Sort topics in forums by name

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.name ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.name ASC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.name ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

 

 

Quote from Asgaros on January 24, 2017, 12:51 pm

The available filters allow you to change the odering of your posts and topics. Here are a few code-example which you have to add to your themes functions.php file if you want to use them.

Show newest posts first in topic

function custom_asgarosforum_filter_get_posts_order($order) {
  $order = 'p1.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_posts_order', 'custom_asgarosforum_filter_get_posts_order');
  1. function custom_asgarosforum_filter_get_posts_order($order) {
  2. $order = ‘p1.id DESC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_posts_order’, ‘custom_asgarosforum_filter_get_posts_order’);
function custom_asgarosforum_filter_get_posts_order($order) {
  $order = 'p1.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_posts_order', 'custom_asgarosforum_filter_get_posts_order');

 Show newest topics first in forum

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.id DESC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

 Show oldest topics first in forum

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.id ASC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

Sort topics in forums by name

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.name ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.name ASC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.name ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

 

 

Quote from Asgaros on January 24, 2017, 12:51 pm

The available filters allow you to change the odering of your posts and topics. Here are a few code-example which you have to add to your themes functions.php file if you want to use them.

Show newest posts first in topic

function custom_asgarosforum_filter_get_posts_order($order) {
  $order = 'p1.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_posts_order', 'custom_asgarosforum_filter_get_posts_order');
  1. function custom_asgarosforum_filter_get_posts_order($order) {
  2. $order = ‘p1.id DESC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_posts_order’, ‘custom_asgarosforum_filter_get_posts_order’);
function custom_asgarosforum_filter_get_posts_order($order) {
  $order = 'p1.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_posts_order', 'custom_asgarosforum_filter_get_posts_order');

 Show newest topics first in forum

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.id DESC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

 Show oldest topics first in forum

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.id ASC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

Sort topics in forums by name

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.name ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.name ASC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.name ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

 

 

Quote from Asgaros on January 24, 2017, 12:51 pm

The available filters allow you to change the odering of your posts and topics. Here are a few code-example which you have to add to your themes functions.php file if you want to use them.

Show newest posts first in topic

function custom_asgarosforum_filter_get_posts_order($order) {
  $order = 'p1.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_posts_order', 'custom_asgarosforum_filter_get_posts_order');
  1. function custom_asgarosforum_filter_get_posts_order($order) {
  2. $order = ‘p1.id DESC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_posts_order’, ‘custom_asgarosforum_filter_get_posts_order’);
function custom_asgarosforum_filter_get_posts_order($order) {
  $order = 'p1.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_posts_order', 'custom_asgarosforum_filter_get_posts_order');

 Show newest topics first in forum

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.id DESC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id DESC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

 Show oldest topics first in forum

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.id ASC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.id ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

Sort topics in forums by name

function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.name ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');
  1. function custom_asgarosforum_filter_get_threads_order($order) {
  2. $order = ‘t.name ASC’;
  3. return $order;
  4. }
  5. add_filter(‘asgarosforum_filter_get_threads_order’, ‘custom_asgarosforum_filter_get_threads_order’);
function custom_asgarosforum_filter_get_threads_order($order) {
  $order = 't.name ASC';
  return $order;
}
add_filter('asgarosforum_filter_get_threads_order', 'custom_asgarosforum_filter_get_threads_order');

 

Hello Thomas, your advise is from 2017.

I want to be sure I can do this without causing any troubles.

Can I add this at the bottom of functions.php?

Rob

Hello @changes

The code is still working fine – I just tested it. 🙂

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Hi, I’m wondering if there might be a way for users to change the ordering on the fly, perhaps by date/most popular/upvotes-downvotes. Thanks!

Hello @makane

A sorting-functionality for this is not implemented it. But I will take your suggestion into consideration for future upates.

makane, jetawa3523@irahada.com and newforum.top have reacted to this post.
makanejetawa3523@irahada.comnewforum.top
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Is it possible to restrict these sorting filters to one forum (or topic)?  I guess the necessary ids are not available when filtering?

@asgaros

Is it somehow possible to force the filter asgarosforum_filter_get_posts_order to act on just one topic or forum?

 

PreviousPage 2 of 3Next