Thread Starter
supervinnie40
(@supervinnie40)
Yes its free, but I don’t know if the author is still very active. Last theme update was 5 months ago I believe.
I’ll sent him a link to this topic.
You could also search the code of the theme if it modifies somewhere the query, e.g. search for “posts_orderby”. Maybe it is used for a feature that you don’t need anyway.
Thread Starter
supervinnie40
(@supervinnie40)
No luck on that last code 🙁
Thread Starter
supervinnie40
(@supervinnie40)
No luck with that last bit of code 🙁
Also tried to search all files with Notepad++ for “posts_orderby”, and it can’t find it anywhere.
Just found:
To remove a hook, the $function_to_remove and $priority arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure.
https://codex.wordpress.org/Function_Reference/remove_filter
So if you discover the priority when the filter was added (if it was added), you could try the same value in the remove_filter.
(Or, better, since the theme doesn’t get updated anymore, remove the priority in the theme where the filter is added.)
Can you post a link to where to get the theme?
Thread Starter
supervinnie40
(@supervinnie40)
https://wordpress.org/themes/wikiwp/
Edit, just noticed that is was updated recently. Doesn’t really matter, because I only downloaded last week.
In your theme’s function.php, could you please edit the function “wikiwpCustomPostOrder” and comment out
// $query->query_vars['orderby'] = 'order';
(l. 214)
I tried here and it helps. Can you confirm?
(PS: Possibly have to undo again the changes from the plugin file.)
Thread Starter
supervinnie40
(@supervinnie40)
Everything working perfectly with the random plugin!! Great.
Any chance you know what was wrong with it? And what that bit of code in Functions.php is supossed to do?
(I’m familiar with PHP, but not that good 😛 )
Woohoo, finally!
My plugin sends a query to retrieve the posts. The theme has registered a hook to modify every query, no matter what you write in your query.
I don’t know what it is for (the theme author might know). You could check if anything on your blog is broken. If not, I would create a Child Theme and there put into function.php the modified function:
// order posts in categories - modified
add_action('pre_get_posts', 'wikiwpCustomPostOrder');
function wikiwpCustomPostOrder($query) {
if( (is_category('news')) ) {
$query->query_vars['orderby'] = 'modified';
$query->query_vars['order'] = 'DESC';
}
}
This will override the original function.
(Without the child theme the changes get lost every time you update your theme.)
BTW, it seems that the redirect_to will still be broken on that “news” category.