Forum Replies Created
-
AuthorPosts
-
Ernest Marcinko
KeymasterLuckily it was not a bug, I just forgot to turn off debug mode in the plugin code π
It should be all right now.Ernest Marcinko
KeymasterHi!
It’s kind of hard-coded, but a simple 1 line modification to the code will help.
Open up the /wp-content/plugins/ajax-search-pro/includes/views/asp.shortcode.php via FTP and go to line 51, where you should see this:
[code]$s_phrases = str_replace(array(‘ ,’, ‘ , ‘, ‘, ‘, ‘ ,’), ‘</a>, <a href="#">’, $style[‘frontend_suggestions_keywords’]);[/code]
change that line to:
[code]$s_phrases = str_replace(array(‘ ,’, ‘ , ‘, ‘, ‘, ‘ ,’), ‘</a> <a href="#">’, $style[‘frontend_suggestions_keywords’]);[/code]
That should do the trick.
Ernest Marcinko
KeymasterHi!
I tried again a few times both urls, but I’m getting redirected back to the front page π
Maybe you need my IP address for firewall exception?
Ernest Marcinko
KeymasterYou are very welcome π
Feel free to rate the plugin if you like it on your codecanyon downloads dashboard: http://codecanyon.net/downloads
Ernest Marcinko
KeymasterHi!
I put it into the ajax search pro instance options, Theme Options -> Custom CSS field π
Ernest Marcinko
KeymasterHi!
Is the correct custom post type selected? It looks like the imported data is “publicatie” post type. You will have to select this post type on the General Options -> Sources panel. (and also on the index table options panel, if you are planning to use it)
Ernest Marcinko
KeymasterHi!
My setup looks like it was correct, it’s working all right.
Plus I added a few CSS rules to help you center the search field. For future reference I added the following rules:
[code]
div[id*=’ajaxsearchprores’] {
margin-top: -34px !important;
}div.block-html-after-header {
padding: 10px;
text-align: center;
}.ajaxsearchpro.asp_main_container {
display: inline-block;
}
[/code]Ernest Marcinko
KeymasterHi!
Thank you for the kind words!
There is unfortunately no documentation on that because it differs for each and every theme on how to do that. Without programming knowledge is almost impossible to append the search into a menu item. WordPress yet does not support putting shortcodes and other stuff to the navigation menu. (navigation menus are very tricky)
What I did on the demo is I appended the search bar just before the menu container in the theme header.php file. I’m almost definitely sure you will have to edit your themes corresponding header file to achieve the same. There is a short article in the documentation on which shortcode do you need for that.
Basically you need to find the template part which adds the menu into the header, then locate the menu element, and try appending the search php shortcode just before it. There is a good chance it’s still going to look weird, because most menus have very fragile styling.
In your case I can see there is already a search bar there, and the HTML code is something like this:
[code]<div class="container et_search_form_container et_pb_search_visible et_pb_no_animation" style="height: 84px; max-width: 838px;">
<form role="search" method="get" class="et-search-form" action="studynet.se">
<input type="search" class="et-search-field" placeholder="SΓΆk β¦" value="" name="s" title="SΓΆk efter:" style="font-size: 12px;"> </form>
<span class="et_close_search_field"></span>
</div>[/code]I would try to locate this piece of code and replace the form element with the correspoding search shortcode, like so:
[html]<div class="container et_search_form_container et_pb_search_visible et_pb_no_animation" style="height: 84px; max-width: 838px;">
<?php echo do_shortcode("[wpdreams_ajaxsearchpro id=1]"); ?>
<span class="et_close_search_field"></span>
</div>[/html]-
This reply was modified 10 years, 9 months ago by
Ernest Marcinko. Reason: formatting fix
Ernest Marcinko
KeymasterHi!
I will definitely take a note on this request, and clean up everything I can for the next release π
Ernest Marcinko
KeymasterHi!
I’ve set up the index table and search configuration for you to search products via the index table. However I cannot verify if it works or not, because your frontend is not loading. The error console says that there is a name resolution problem with your CDN provider and no JS and CSS files are loaded.
Let me know once it’s fixed and I check the configuration again πErnest Marcinko
KeymasterYou are welcome!
Indeed, I made a syntax error there.
For future reference the correct code:
[php]
add_filter( ‘asp_results’, ‘asp_checkbox_to_results’, 1, 1 );function asp_checkbox_to_results( $results ) {
foreach ($results as $k=>$v) {
// Get the field
$checkboxes = get_field(‘my_checkbox_list’, $v->id);
// Append if exists
if( $checkboxes ){
$checkbox_string = implode(‘, ‘, $checkboxes);
$results[$k]->content .= " β " . $checkbox_string;
}
}return $results;
}
[/php]Ernest Marcinko
KeymasterHi!
If I understand correctly, You want to replace specific words by alternatives. The only possible way right now is to add a custom filter function to modify the input text silently before it hits the database. A possible function would be:
[php]add_filter(‘asp_search_phrase_after_cleaning’, ‘asp_alternate_words’, 1, 1);
function asp_alternate_words( $s ) {// An array of the originals you want to replace
$originals = array(
"word1",
"word2",
"wordN"
);/* Array of the alternatives
* .. must be the same number as the originals
* "word1" is replaced with "alt1"
* "word2" is replaced with "alt2" etc..
* */
$alternatives = array(
"alt1",
"alt2",
"altN"
);return str_replace($originals, $alternatives, $s);
}[/php]
Put this to your themes functions.php file. As you can see from the code comments you can add as many words and replacements as you need.
Ernest Marcinko
KeymasterSure, I don’t see why not π
Ernest Marcinko
KeymasterHi!
This is only possible with a modification directly in the code. It might not work correctly, but it’s worth a try.
Open up the wp-content/plugins/ajax-search-pro/includes/views/asp.shortcode.categories_terms.php file and go to lines 124-128, where you should see this:
[php]$_needed_terms_full = get_terms($taxonomy, array(
‘orderby’ => $term_ordering[0],
‘order’ => $term_ordering[1],
‘include’ => $terms
));[/php]change that code to this:
[php]$_needed_terms_full = get_terms($taxonomy, array(
‘orderby’ => $term_ordering[0],
‘order’ => $term_ordering[1]
));[/php]This should get all the terms for a taxonomy, if at least one term is selected from the taxonomy.
Ernest Marcinko
KeymasterHi!
In case you are using the index table engine, you will have to re-generate the index table to register the imported posts.
If not, then make sure that the imported items are in published state, the correct post types are selected, and the search cache is not enabled.
-
This reply was modified 10 years, 9 months ago by
-
AuthorPosts