Support Forum
the code looks exactly like yours plus the php tags and some comments I added, here you are:
<?php
# --------------------------------------------------------------------------------------
#
# Simple:Press trick to order the topis in the forums:
# 5: Pesate settimanali
# 6: Diario Alimentare
# 17: Diario: commenti e domande
# 18: Pesate: commenti e domande
# in ascending order for the creation date.
# This file has been created by hand, named sp-user-functions.php and
# put into the wp-content folder of mspforum.
# The whole thread on the support forum is at this link:
# https://simple-press.com/suppo.....k/#p159916
#
# --------------------------------------------------------------------------------------
add_filter('sph_forumview_query', 'my_topic_sort', 1, 2);
function my_topic_sort($db, $data) {
$fids = '&5&6&17&18&';
if ( strpos( $fids, '&'.$data->forumId.'&' )) {
$db->orderby = 'topic_pinned DESC, spf_sftopics.topic_id DESC';
}
return $db;
}
?>
I had to add it directly under the wp-content folder right? That sounded a little strange that's why I ask again...
My forum (in Italian) is: MsPforum
Andy's question about how you copied it still applies... if you copied the text directly in the post, you probably got some invalid characters... you must view the raw code and copy it from the popup to ensure you dont get the invalid chars..
Visit Cruise Talk Central and Mr Papa's World
I don't understand what you mean with "raw code". I used notepad and edited the code, which I then copied and pasted here. Can you please explain? Thanks and goodmorning!
My forum (in Italian) is: MsPforum
Let's just step back. IF after a code change or addition, something stops displaying completely then that is indicative of a coding error. So it is always vital to ensure that everything is totally correct.
Pasting code into a forum post may look like it is correct but actually the display engine has stripped all coding specific components and replaced them with html entities. If you do not know hat they are then it doesn't matter. It just means that what might look like good code probably is not if simply copied and pasted.
Ans this is why we use our syntax highlighter plugin to pass code to users as this does ensure that the code is not converted by the display engine.
If you go back to the code I gave you - post 7 I believe - then you will see above it a 'war code' button. Click on that and you will get a popup window with the actual, unconverted code, That is what you need to copy into your clipboard before placing it into the new php file. And also you MUST ensure that the editor you use is in plain text mode.
And finally - Ike was wrong I am afraid. You DO need to enclose the code in php tags. Make sure that there are no empty lines either side of the tags. The opening tag must be on l;ine 1 and the closing tag must be on the last line with no empty space below it.
And finally, finally ! - yes - the file just goes into the wp-content folder. It is a special file that we check for that allows people to have a little bit of custom code without having to make a child theme - although child themes are the better and recommended route.
YELLOW
SWORDFISH
|
ok got it, I did not know about this "war code", I like it Going to try right now...
My forum (in Italian) is: MsPforum
it does not work, I made the file back from scratch, no comment lines, only the raw code and the php tags beggining and end
My forum (in Italian) is: MsPforum
I mean that the list with all the topic disappears (but the pages numbers at the bottom are still displayed): I will send you the file in 5 minutes!
My forum (in Italian) is: MsPforum
1 Guest(s)