Support Forum
I am running 5 Beta RC live on my website (I know running live isn't recommended but I needed some of the new features) and it looks great and, so far is working without incident. Congratulations on a substabtial improvement to an already great product! If you want to take a look, visit Waterway Watch.
A couple of questions:
1. I have successfully moved a number of topics from one forum to another. The topics are named in a way that anticipates alphabetical sorting by title - is there a way to do that?
2. When upgrading from 4.5.1 to 5.x I was given an opportunity to update the structure of the database to v5 format. I declined at the time because I wanted to retain the option of switching back to 4.5.1. I would now like to take that option: how do I do that?
Regards
Will
There are no built in options to sort alphabetically but V5 has an extensive adoption of WP style hooks (actions and filters) and one of these is available that can change the sort order. So - it just needs a few small lines of code. Do you know you way around filters and php?
YELLOW
SWORDFISH
|
Yellow Swordfish said
There are no built in options to sort alphabetically but V5 has an extensive adoption of WP style hooks (actions and filters) and one of these is available that can change the sort order. So - it just needs a few small lines of code. Do you know you way around filters and php?
I'm fairly competent at php but would need to read up on WP filters but that does't sound too daunting, its onnly code & logic.
Cheers
Will
It is actually very simple. A filter works by passing a piece of data to your function. You can then optionally massage/change that data and send it back.
In this case the filter is called 'sph_forumview_query' and it passes an object of the different components of the sql statement that makes up the topic list query in forum view. One of the properties of that data object is 'orderby'.
So basically you could add a filter, change the sort order and send it back.
Something like -
add_filter('sph_forumview_query', 'my_sort_function'); function my_sort_function($sqlObj) { $sqlObj->orderby = SFTOPICS . '.topic_name ASC'; return $sqlObj; }
Put that code in the spFunctions.php of the V5 theme you are using and topics will show alphabetically starting with the 'A's.
A few things: (1) In this state this will apply to ALL Forums when displaying the Forum View. (2) As always we recommend making your own theme (copy) before making changes to avoid them being lost on an update and (3) bear in mind that sorting by the topic name string will always be slower than the current sort on numeric key columns.
YELLOW
SWORDFISH
|
1 Guest(s)