Notifications
Clear all

wpForo 1.x.x [Closed] URL to post in widget doesn"t work when using filter to change post order

10 Posts
4 Users
0 Reactions
1,299 Views
Posts: 5
Topic starter
(@simsi)
Active Member
Joined: 3 years ago

Hello 🙂

I used the filter, to be able to change the post order (display recent post first) but on the widget the url to the message is not working. If I disable the filter, the link is working but I really want to display the recent post in first.

Im using widget WpForo Recent Post.

add_filter('wpforo_post_list_args', function ($args){
	if(!empty($args)){
		$args['orderby'] = '`is_first_post` DESC, `created` DESC, `postid` DESC';
	}
	return $args;
});
9 Replies
Robert
Posts: 10590
Admin
(@robert)
Support Team
Joined: 9 years ago

@simsi,

Please let me know where have you found this code. What forum layout do you use?

Posted by: @simsi

but on the widget the url to the message is not working.

Where we can see the issue?

1 Reply
(@simsi)
Joined: 3 years ago

Active Member
Posts: 5

Hello Robert ! Thanks you for your answer !

I found an answer from you there : https://wpforo.com/community/postid/15418/

You can see the issue there : https://brazuca.info/ on the right sidebar, you can see recent forum posts and if you click a link its going to the wrong place.

If I check the url of the post I can see : /paged/2/#post-40 but now with the filter it should be on the first page.

Im using Extended Layout

dimalifragis
Posts: 2611
(@dimalifragis)
Famed Member
Joined: 5 years ago

You have JS crashes:

 

Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3

https://brazuca.info/wp-content/themes/splash/assets/js/bootstrap.min.js?ver=4.2: 6" role="listitem"><anonymous> https://brazuca.info/wp-content/themes/splash/assets/js/bootstrap.min.js?ver=4.2 :6
https://brazuca.info/wp-content/themes/splash/assets/js/bootstrap.min.js?ver=4.2: 6" role="listitem"><anonymous> https://brazuca.info/wp-content/themes/splash/assets/js/bootstrap.min.js?ver=4.2 :6
https://brazuca.info/wp-content/themes/splash/assets/js/bootstrap.min.js?ver=4.2: 6" role="listitem"> 
4 Replies
(@simsi)
Joined: 3 years ago

Active Member
Posts: 5

Exact ! mais ces erreurs Javascript ne sont pas a l'origine du soucis des URLs car elle semble être chargé en PHP

dimalifragis
(@dimalifragis)
Joined: 5 years ago

Famed Member
Posts: 2611

I have no idea what you are talking about, please speak in english.

(@simsi)
Joined: 3 years ago

Active Member
Posts: 5

Oh sorry you are right ^^

I check the javascript errors and is not causing the bug cause URL are from PHP not from JS. I had a look on the code to figure out how its working but im not able to understand the way where the posts links are created.
So yes I have an JS error but Im sure is not the reason of the link bug 🙂

Btw, thank you for your help/

dimalifragis
(@dimalifragis)
Joined: 5 years ago

Famed Member
Posts: 2611

Never said that this is causing the issue you have. But you have your pages CRASHING and that is serious. They do NOT complete.

Posts: 992
Moderator
(@martin)
Support Team
Joined: 8 years ago
Posted by: @simsi

I check the javascript errors and is not causing the bug cause URL are from PHP not from JS.

JS error stops the wpForo core JS redirection. Please note, that wpForo checks the #post-100 ID and redirects to correct page even if the /3/ page is not correct. So you'll not have any problem if you fix all your JS errors. The URLs in sidebar will work by redirection.

Posts: 5
Topic starter
(@simsi)
Active Member
Joined: 3 years ago

Ok sweet ! Thank you, I will try to fix it 😉