Need help setting up a search

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Need help setting up a search

This topic contains 5 replies, has 2 voices, and was last updated by rouge1 rouge1 5 years, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #21417
    rouge1
    rouge1
    Participant

    Hi. You’ve really created a powerful tool. These search settings are like fun puzzles. But this one has stumped me.

    My client is a comic book publisher. The publish franchises such as Planet of the apes, Power Rangers, etc. They want me to create a Franchise landing page that provides access to all of the published titles of that franchise. So, for example, I would create a Planet of the Apes landing page that would house the search bar. Then I’d create a page for each Planet of the Apes title. The landing page should automatically populate with all of the Planet of the Apes titles. Then I should be able to use the search bar to find a specific title.

    How would I set up the search so that only Planet of the Apes title populate this landing page? What would I use as search criteria? Tags? The actual post titles? I’m assuming the pages would have to support tags and or categories (like a post or portfolio page).

    I’m a bit lost! 🙂

    I started playing with a search named “FRANCHISE SEARCH PLANET OF THE APES”. I didn’t get very far. lol.

    • This topic was modified 5 years, 1 month ago by rouge1 rouge1.
    #21435
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thank you very much for your kind words!

    Okay, I think your first step would be to categorize the posts/pages. For each franchise, I would make a category (ex. Planet of the Apes) and put all the Planet of the Apes pages there. This way, there is now a connection between each page. I think this is the easiest and most reliable solution, as it might also get handy in the future with other plugins as well.

    Then, there is a feature in the plugin, that allows you to include results from specific categories only: Documentation – Restrict to category
    For each page, you could create a search bar, and configure these restrictions individually. I believe this is the easiest and most straightforward solution.

    If you are planning to have lots of categories, then instead of creating a search bar for each, using a minor custom snippet could be more convenient, so that only one search bar is sufficient. In that case, this knowledge base with the custom code can be life saving. It will automatically restrict the results for the current page category.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #21457
    rouge1
    rouge1
    Participant
    You cannot access this content.
    #21458
    rouge1
    rouge1
    Participant
    You cannot access this content.
    #21472
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    1. The default search autocomplete and suggestions source is set to Google API, which unfortunately does not consider the currently active site, because it’s a free service. On the upside it’s extremely fast (as it runs on google servers), on the downside it’s not always relevant.
    You can change the sources of these of course, please check this documentation how to do that.

    2. It is intended behavior, there is no option for that unfortunately. However using a custom code it might be possible. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

    add_action('wp_footer', 'asp_show_default_results_on_empty');
    function asp_show_default_results_on_empty() {
        ?>
        <script>
        jQuery(function($){
          $('.proclose svg').on('click', function(){
            var $s = $(this).closest('.asp_m');
            var id = $s.data('id');
            var inst = $s.data('instance');
            if ( $s.find('input.orig').val() != '' )
              setTimeout(function(){
                  ASP.api(id, inst, 'searchFor', '');
              }, 300);
          });
        });
        </script>
        <?php
    }

    This is not the best approach, as it won’t clear the filters, only the input field, and only if there was a search phrase present, but it should work for most cases.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #21501
    rouge1
    rouge1
    Participant
    You cannot access this content.
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.