Please or Register to create posts and topics.

latest post at top of list

Page 1 of 2Next

How do I reverse the order of posts to make the latest post at the top?

Hello @peter208a

Please check out the following topic. The first code-example should be the one you are looking for.

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

I don’t know how to do that

I will get my computer literate friend to do that

Thank you

I just tried that myself as I found the right file but I added it at the very bottom but when I clicked on the update button it wouldn’t update the file

If you cant update the files via the WordPress-editor, you need to adjust the file-permissions via a FTP-application:

https://codex.wordpress.org/Changing_File_Permissions

Alternatively you can upload the updated file manually via your FTP-application.

If you not sure how to do it please let your friend do it because otherwise there is the risk that your website is not accessible anymore.

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

functions.php gives a path to wp-admin/theme-editor.php

functions.php appears to be in the wp-content folder

So I am confused

I copied both files so that I can get back to the original if necessary

I tried putting the following code in both files – neither alters the order of posts putting the newest post 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’);

@peter208a

You need to put the code in theĀ functions.php file of the theme which you are using on your site (/wp-content/themes/your-theme/functions.php).

The code has to be at the end of the file, but before the closing ?> (when ?> doesnt exist, it doesnt matter).

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

OK – understood

That is what I have tried – I will try again

I notice the following is before the instructions in the file – do I need to put this before your code

/**

See below the line of hyphens the last few lines of code in the present file

———————————————————————————————————

/**
* Additional features to allow styling of the templates.
*/
require get_parent_theme_file_path( ‘/inc/template-functions.php’ );

/**
* Customizer additions.
*/
require get_parent_theme_file_path( ‘/inc/customizer.php’ );

/**
* SVG icons functions and filters.
*/
require get_parent_theme_file_path( ‘/inc/icon-functions.php’ );

I added the code and it makes no difference – it doesn’t work

This is how the end code now looks – I have placed it for you to view under the line below


/**
* Additional features to allow styling of the templates.
*/
require get_parent_theme_file_path( ‘/inc/template-functions.php’ );

/**
* Customizer additions.
*/
require get_parent_theme_file_path( ‘/inc/customizer.php’ );

/**
* SVG icons functions and filters.
*/
require get_parent_theme_file_path( ‘/inc/icon-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’);

Hello @peter208a

The code looks fine, but you used the code for topic-ordering and not the one for post-ordering in your example. Please replace it with the correct one, ensure that caching is disabled for your forum-page and it should work fine.

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