Please or Register to create posts and topics.

Change ordering of posts/topics

Page 1 of 3Next

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');

 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');

 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');

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');

 

cauesocial and Pino Strano have reacted to this post.
cauesocialPino Strano
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thanks, that´s very helpful.

Regards, Andreas

Quote from Andreas on January 24, 2017, 1:03 pm

Thanks, that´s very helpful. Regards, Andreas

Agreed, Was wondering about this!

I don’t understand in which page I must copy the code… I haven’t functions.php file in the extension files… thanks

Quote from pysteelandt on July 31, 2017, 5:59 pm

I don’t understand in which page I must copy the code… I haven’t functions.php file in the extension files… thanks

In your current design theme

Hi Again!

Thanks for all your support and taking the time to respond to people here:)

Question on the ordering of Topics under a Category the Main Forum:

Is there a filter to  order all topics inside the Category by latest Posts?

I have a category with 20 topics and I always want the topic with the newest post on top.

Thanks.

Hi,

I get this error (on my local installation) when I add the code to functions.php and try to create a new topic.

Any idea? The tickbox for subscribe is NOT ticked when I try to create a new topic. I am also admin user, and I have the newest version of the plugin.

( ! ) Fatal error: Uncaught ArgumentCountError: Too few arguments to function AsgarosForumNotifications::subscribe_topic(), 0 passed in /srv/www/example.com/current/web/app/themes/generatepress_child/functions.php on line 64 and exactly 1 expected in /srv/www/example.com/current/web/app/plugins/asgaros-forum/includes/forum-notifications.php on line 115
( ! ) ArgumentCountError: Too few arguments to function AsgarosForumNotifications::subscribe_topic(), 0 passed in /srv/www/example.com/current/web/app/themes/generatepress_child/functions.php on line 64 and exactly 1 expected in /srv/www/example.com/current/web/app/plugins/asgaros-forum/includes/forum-notifications.php on line 115

 

Hello @notechup

Topics are automatically ordered by the time of latest-post as long as you dont overwrite the default-behavior via hooks/filters.

Regarding the php-error: Please check the functions.php file of your theme. It seams that you dont pass one of the necessary arguments in line 64.

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

I want my order of categories changed but i am a complete n00b at this forum. Not real good at editing the functions file. I added the code but nothing has changed. I really need any help you can give me. Thanks so much in advance

 

// Elementor Compatibility requires PHP 5.4 for namespaces.
if ( version_compare( PHP_VERSION, ‘5.4’, ‘>=’ ) ) {
require_once ASTRA_THEME_DIR . ‘inc/compatibility/class-astra-elementor.php’;
require_once ASTRA_THEME_DIR . ‘inc/compatibility/class-astra-elementor-pro.php’;
}

// Beaver Themer compatibility requires PHP 5.3 for anonymus functions.
if ( version_compare( PHP_VERSION, ‘5.3’, ‘>=’ ) ) {
require_once ASTRA_THEME_DIR . ‘inc/compatibility/class-astra-beaver-themer.php’;
}

/**
* Load deprecated functions
*/
require_once ASTRA_THEME_DIR . ‘inc/core/deprecated/deprecated-filters.php’;
require_once ASTRA_THEME_DIR . ‘inc/core/deprecated/deprecated-hooks.php’;
require_once ASTRA_THEME_DIR . ‘inc/core/deprecated/deprecated-functions.php’;
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’);

https://tenahhouserecoveryllc.com/forum/

i want th forums rules firsts, then the section with general questions, then the drug of choice. This forum is for a rehab inpatient facility. Thanks again

Page 1 of 3Next