Looking for support? You can access the support system via your account.
Forums › Forums › Search & Filter Pro › Custom Results List On Custom Page
- This topic has 5 replies, 3 voices, and was last updated 6 years, 7 months ago by Ross.
-
Our-Pub(Private) September 4, 2017 at 4:17 pm #129053
Hi
I’ve purchased the PRO version of this plugin and I’m hoping someone can help me make it do what i need?
I’ve set up a simple filters form and placed the shortcode on a page outside of WordPress. (I’m just using WP for the backend and coding the frontend from scratch) I would like the results to appear on the same page below the filter list.
I have so far…
<?php require('wp-root-folder-name/wp-blog-header.php'); ?> <?php // Create connection $con=mysqli_connect("Blah, Blah, Blah, Blah"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type='text/javascript' src='http://www.the-tpg.co.uk/wp-root-folder-name/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script> <script type='text/javascript' src='http://www.the-tpg.co.uk/wp-root-folder-name/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1'></script> <script type='text/javascript' src='http://www.the-tpg.co.uk/wp-root-folder-name/wp-content/plugins/search-filter-pro/public/assets/js/search-filter-build.min.js?ver=2.3.4'></script> <script type='text/javascript' src='http://www.the-tpg.co.uk/wp-root-folder-name/wp-content/plugins/search-filter-pro/public/assets/js/chosen.jquery.min.js?ver=2.3.4'></script> <script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/i18n/jquery-ui-i18n.min.js?ver=2.3.4'></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>The Tameside Pub Guide</title> </head> <body> <h1>Events</h1> <?php echo do_shortcode('[searchandfilter id="56"]'); ?> <div id="eventResultsContainer"> <?php $args = array('post_type' => 'post'); $args['search_filter_id'] = 56; $query = new WP_Query($args); //run the event posts loop while ( $query->have_posts() ) : $query->the_post(); echo get_the_author() . '<br/>' . get_the_title() . '<br/><hr/>'; endwhile; //end loop ?> </div> </body> </html>
I’m getting all the right results but the filters aren’t updating the list. (See page http://www.the-tpg.co.uk/The-TPG.php)
I copied the links to the JS files from a page I managed to get working inside a WP template page but I’m now pretty stuck and would appreciate it if someone could point me in the right direction?
Cheers,
Mark.Trevor Moderator(Private) September 4, 2017 at 4:34 pm #129056I have little doubt that you have made a coding error, but would have no idea where. Why are you not using a theme, even a bare bones one? What advantage do you gain?
Trevor Moderator(Private) September 5, 2017 at 8:24 am #129150This reply has been marked as private.Ross Moderator(Private) September 20, 2017 at 1:54 pm #132061Hi there
I had a look.,
It does seem like something could be wrong with the code.
I can see in there, you have manually loaded the S&F scripts? eg:
<script type='text/javascript' src='http://www.the-tpg.co.uk/wp-root-folder-name/wp-content/plugins/search-filter-pro/public/assets/js/search-filter-build.min.js?ver=2.3.4'></script>
You should not need to do this.
S&F (and many other plugins) will load their scripts automatically using
wp_enqueue_scripts
.The issue I can see is that you are not calling
wp_head()
andwp_footer()
, which auto generates all of this stuff, and allows plugins to use WP actions likewp_enqueue_scripts
.https://codex.wordpress.org/Function_Reference/wp_head
https://codex.wordpress.org/Function_Reference/wp_footerCheck the default WP themes for correct usage of these two functions – they are usually the first and last things that need to be loaded in your template files.
Just to note, when you run
wp_head()
, then are a ton of WP events that will fire, which again may be essential to fire in order to use some plugins (S&F included), such as S&F initialising the query vars, or correctly loading scripts with dependencies. By you not loading the head and footer functions, you are effectively disabling a lot of WP functionality / integration.Does that make sense?
Let me know how you get on.
Thanks
-
AuthorPosts
You must be logged in to reply to this topic.