Forums › Forums › Search & Filter Pro › Getting Page Not Found on ALL search/Filter attempts plus AJAX not working
- This topic has 7 replies, 2 voices, and was last updated 10 years, 3 months ago by Ross.
-
Anonymous(Private) July 20, 2014 at 3:49 pm #2680
Not sure what I am missing, but each time I try to filter or search, I am taken to a page not found. Here is the link to where the form is: http://craftsmensguildofms.org/members/
Also…in the sort by…I was wanting to sort by ASC or DESC by the artist name. I’m using Advanced Custom Fields to create the custom fields. The name of the artist is the “Title”. Not sure where how to set the order by for that?
One more thing…AJAX is not working either for the search results so tried to disable. But…still getting the page not found.
Would be more than happen to give WP credentials if that would help.
Anonymous(Private) July 20, 2014 at 4:13 pm #2681Crap..I had the wrong checkbox on the rightside selected. Search Results are now working with the filtering. Still having a problem with the AJAX and the sorting. And just to be clear on the sorting problem as I don’t think I explained correctly. The Post Type is “Members” and the name of the artist that I’m trying to sort by is one of the entries added to the post type of Members. Hopefully that makes sense:) Am trying to avoid having the client go back and add the Member name as a custom field instead of the title as they have already entered in over 370 entries.
Ross Moderator(Private) July 21, 2014 at 1:35 pm #2706Hey Brent
To set a default sort order try this in your functions.php:
function order_results_default( $query ) { global $sf_form_data; global $wp_query; if ( $sf_form_data->is_valid_form() && $query->is_main_query() && !is_admin()) { if(!isset($wp_query->query['sort_order'])) { $query->set('orderby', 'title'); $query->set('order', 'DESC'); } } } add_action( 'pre_get_posts', 'order_results_default', 21 );
🙂
Anonymous(Private) July 22, 2014 at 2:06 am #2751Great fix and incredible plugin! Thank you! Quick question..I remember seeing you saying not to put any queries, I think, before the loop as they would mess up what the plugin does. Any advice on how I can set the order by default, on page load, to order by title ASC?
Ross Moderator(Private) July 22, 2014 at 1:33 pm #2783Hey Brent
You can of course place custom code / queries before the main loop, however as with any regular WP template, in order for your custom query not to affect the main query, you must do something along the lines of resetting the main query back to the original one once you have finished processing:
Take a look here:
http://codex.wordpress.org/Function_Reference/wp_reset_query🙂
Anonymous(Private) August 18, 2014 at 6:05 pm #3693Just a heads up…the code you gave me above to put into the Functions.php file has caused my site to completely crash each time I have upgraded your plugin to the latest version. Looking at the error log:
[18-Aug-2014 16:16:14 UTC] PHP Fatal error: Call to a member function is_valid_form() on a non-object in /home4/craftso5/public_html/wp-content/themes/crafts/functions.php on line 580When I remove the code from the functions file…site has come back with no problems.
Anonymous(Private) August 18, 2014 at 6:40 pm #3694Also…I’m still not 100% following how to add a simple order and orderby query without throwing off the main query. Following the link you provided…I can see the custom query and the area to put the loop…but if I go by that…it breaks the main query and no longer pulls the content I need. So just having a hard time figuring out where to put this query and also having the main loop still work.
Ross Moderator(Private) August 19, 2014 at 1:41 pm #3728Hey Brent sorry been a bit busy here – do you want to send me over your login details via our contact form (http://www.designsandcode.com/contact/) and I’ll try to take a look tonight or tomorrow?
Thanks
-
AuthorPosts