Title: syrupcore's Replies | WordPress.org

---

# syrupcore

  [  ](https://wordpress.org/support/users/syrupcore/)

 *   [Profile](https://wordpress.org/support/users/syrupcore/)
 *   [Topics Started](https://wordpress.org/support/users/syrupcore/topics/)
 *   [Replies Created](https://wordpress.org/support/users/syrupcore/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/syrupcore/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/syrupcore/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/syrupcore/engagements/)
 *   [Favorites](https://wordpress.org/support/users/syrupcore/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 167 total)

1 [2](https://wordpress.org/support/users/syrupcore/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/syrupcore/replies/page/3/?output_format=md)…
[10](https://wordpress.org/support/users/syrupcore/replies/page/10/?output_format=md)
[11](https://wordpress.org/support/users/syrupcore/replies/page/11/?output_format=md)
[12](https://wordpress.org/support/users/syrupcore/replies/page/12/?output_format=md)
[→](https://wordpress.org/support/users/syrupcore/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Jetpack - WP Security, Backup, Speed, & Growth] Jetpack Comments + Akismet?](https://wordpress.org/support/topic/jetpack-comments-akismet/)
 *  Thread Starter [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/jetpack-comments-akismet/#post-8788096)
 * Clarifies them both perfectly. Thank you for very much taking the time.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Indexing 1-3 Character Custom Fields](https://wordpress.org/support/topic/indexing-1-3-character-custom-fields/)
 *  Thread Starter [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/indexing-1-3-character-custom-fields/#post-7227778)
 * Cheers, Mikko. Yep, having the minimum set to “1” is working fine in practice.
 * > There’s no easy solution to make the minimum length apply to just one thing,
   > because the same minimum length is used in indexing and in searching.
 * Makes sense. Indexing takes roughly the same time regardless of minimum. When
   searching for one or two character phrases though, it takes quite a bit longer
   but that is sort of expected (though I dunno if regular users will be expecting
   it!). Almost want to say the length doubles with each character removed but I
   haven’t measured it or anything.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] No search results – search.php has query](https://wordpress.org/support/topic/no-search-results-searchphp-has-query/)
 *  [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/no-search-results-searchphp-has-query/#post-7023751)
 * Try replacing:
 *     ```
       $search_results = new WP_Query( array( 's' => $s, 'posts_per_page' => -1 ) );
       $total = $search_results->post_count;
       ```
   
 * with
 *     ```
       $total = $wp_query->found_posts;
       ```
   
 * instead of instantiating a new WP_Query. Think that’s basically wiping out relevanssi.
 * Also note `$wp_query->found_posts` will give you the total results for the query
   while `$wp_query->post_count` will only return how many posts objects were returned
   for the current view. That is, you may have 40 total results for the term `red`
   but if you have it set to display 10 results per page, `post_count` will be `
   10` while `found_posts` will be `40`. For normal WP searches, the code you have
   would be fine due to the -1 but [Relevanssi doesn’t work with posts_per_page](http://www.relevanssi.com/knowledge-base/posts-per-page/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Feature Suggestion](https://wordpress.org/support/topic/feature-suggestion-64/)
 *  [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/feature-suggestion-64/#post-7012592)
 * You can use `relevanssi_match` filter for this.
 * See the second example on this page: [http://www.relevanssi.com/knowledge-base/relevanssi-match/](http://www.relevanssi.com/knowledge-base/relevanssi-match/)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Include Author result in search](https://wordpress.org/support/topic/include-author-result-in-search/)
 *  [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/include-author-result-in-search/#post-7024273)
 * Do you mean including the author of each search result on the search results 
   page? That would depend on your `search.php` set up. If so, you can just include
   author template tags within your loop.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Features possible using this plugin](https://wordpress.org/support/topic/features-possible-using-this-plugin/)
 *  [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/features-possible-using-this-plugin/#post-6940683)
 * As far as a Google Maps search, you can just do that with Javascript within your
   search results template. Probably easiest to include the script block directly
   within the results template (or included template part) because then you’ll have
   access to the searched term.
 * Using [Google’s example code](https://developers.google.com/maps/documentation/javascript/examples/place-radar-search),
   replace `performSearch().request{}.keyword` (set to “best view” in the example)
   with `<?php the_search_query(); ?>`. There are other ways to use the maps API
   for searching, depending on what you want to do, but presuming you’ve including
   the HTML and API JS properly, that orta ‘just work’. It will appear a little 
   after the local results appear but gmaps searches are blazing fast on the whole.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Features possible using this plugin](https://wordpress.org/support/topic/features-possible-using-this-plugin/)
 *  [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/features-possible-using-this-plugin/#post-6940682)
 * I’ve been thinking about building a keyword suggestion UI on top of Relevanssi.
   Haven’t started but here’s what I’m thinking in case you want to give it a go
   [@world2cycle](https://wordpress.org/support/users/world2cycle/).
    1. Polling the wp_relevanssi_log table, pull any log entry that has more than, 
       say, 5 in the `hits` column. Create a JS object with it (keeping the hits number).
    2. Make a JS array from that object that is (somehow) sorted by 1) number of hits
       and 2) number of occurrences within the log. That would make the list sorted
       by both usefulness (# of hits) and popularity (# of occurrences).
    3. Use something like Awesomeplete/Typeahead/whateverlibrary to actually offer 
       the suggestions from the JS object.
    4. Can also pull post titles, tags, categories, etc to put into the same JS object
       the autocomplete library will pull from. Typeahead actually has some create 
       facilities for using multiple JS objects and presenting them separately within
       the suggestions so you could, for example, have keywords, posts and tags all
       separated.
 * I don’t think it would actually be all that hard I just haven’t found the time
   to try it out.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Different Search for Stopwords?](https://wordpress.org/support/topic/different-search-for-stopwords/)
 *  Thread Starter [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/different-search-for-stopwords/#post-6907665)
 * Thank you, Mikko!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Different Search for Stopwords?](https://wordpress.org/support/topic/different-search-for-stopwords/)
 *  Thread Starter [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/different-search-for-stopwords/#post-6907542)
 * Aha! in `/lib/search.php`, there is a variable called `$remove_stopwords` which
   is hard coded to `true`. A couple of lines later, this happens:
 * `$terms = relevanssi_tokenize($q, $remove_stopwords);`
 * And since the second argument for `relevanssi_tokenize` is `$remove_stops`, the
   stopwords never get through. When I set “$remove_stopwords” to `false`, all works
   as expected. Guess that would need to be somehow tied into the possible filter?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] Different Search for Stopwords?](https://wordpress.org/support/topic/different-search-for-stopwords/)
 *  Thread Starter [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/different-search-for-stopwords/#post-6907541)
 * Thanks for this, Mikko. I changed the line in /lib/indexing.php and reindexed.
   Good news is: it indexed the stopwords in titles (I checked the wp_relevanssi
   table via mysql directly). Unfortunately, when I search for one of the stopwords
   I know it indexed… I get no results. Do I need to change something else?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] ACF Relationship field](https://wordpress.org/support/topic/acf-relationship-field/)
 *  [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/acf-relationship-field/#post-6793425)
 * Thank you both! Helped me quite a bit. I’m using CMB2’s “Related Posts Field”
   which stores a single ‘related’ post ID. Here’s what worked for me:
 *     ```
       add_filter('relevanssi_content_to_index', 'MY_include_related_content', 10, 2);
       add_filter('relevanssi_excerpt_content', 'MY_include_related_content', 10, 2);
   
       function MY_include_related_content($content, $post) {
   
           $related = get_post_meta( $post->ID, 'custom_field_with_post_id', true );
   
           if (is_numeric($related)) {
       		$content .= apply_filters('the_content', get_post_field('post_content', $related));
       	}
   
           return $content;
       }
       ```
   
 * [@mikko](https://wordpress.org/support/users/mikko/) also posted this over on
   the blog post that lead me.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[CMB2] Before/Before Row.. on a Group field?](https://wordpress.org/support/topic/beforebefore-row-on-a-group-field/)
 *  Thread Starter [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/beforebefore-row-on-a-group-field/#post-6774750)
 * I’m in!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[CMB2] Before/Before Row.. on a Group field?](https://wordpress.org/support/topic/beforebefore-row-on-a-group-field/)
 *  Thread Starter [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/beforebefore-row-on-a-group-field/#post-6774693)
 * Thanks very much, Michael. Totally missed that hook. I saw [https://github.com/WebDevStudios/CMB2/wiki/Tips-&-Tricks#using-the-dynamic-beforeafter-form-hooks](https://github.com/WebDevStudios/CMB2/wiki/Tips-&-Tricks#using-the-dynamic-beforeafter-form-hooks)
   at some point but didn’t put 2 and 2 together. Using that along with separated
   meta boxes (I was cramming it all into one giant box) is what I c/should do.
 * I guess this is a feature request then. 🙂 To whatever extent is reasonable, 
   have feature parity for group fields. I understand enough to know that they’re
   very different beasts and feature parity isn’t possible (or even needed for parts
   of it) but it would be sweet to have these sorts of row manipulators available
   to them if possible.
 * Would also be handy to have a single CMB2 wiki page with all of the available
   CMB2 hooks listed on it. A sort of one-stop-shop to look in when you want to 
   augment the behavior of CMB2. I browsed the wiki and searched around the internets
   before asking this here but I don’t think I know/knew enough to plop in the right
   keywords to have that appear.
 * Anyway, thanks again. Marking as resolved.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[CMB2] Before/Before Row.. on a Group field?](https://wordpress.org/support/topic/beforebefore-row-on-a-group-field/)
 *  Thread Starter [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/beforebefore-row-on-a-group-field/#post-6774688)
 * Thanks, Michael.
 * Basic test code follows. In this example I tried basically all options on both
   places I could think to try them. I’m tried reading through the source to see
   if this was even possible but TBH, got a little (ok, a lot) lost.
 * My use case is: this group contains a set of fields with 4 different fields. 
   I want to have some introductory text in a particular set of styles before the
   group starts. I found a way around that by including a “title” field which does
   support all of the before/after stuff. I’m also using CSS to cheat and make the
   group look like a separate set of meta boxes. Without before and after, that 
   requires some fairly fragile CSS selectors instead of generic classes.
 * On this same note, it would be lovely if group fields also supported `row_classes`.
 *     ```
       $local_actions_group_field = $coa_cmb->add_field( array(
       	'id' => $prefix . 'local_conservation_actions_and_plans',
       	'type'        => 'group',
       	'description' => __( 'Local Conservation Action or Plans', 'odfw' ),
       	'before_row'   => '<p>Testing <b>"before_row"</b> parameter</p>',
       	'before'       => '<p>Testing <b>"before"</b> parameter</p>',
       	'before_field' => '<p>Testing <b>"before_field"</b> parameter</p>',
       	'after_field'  => '<p>Testing <b>"after_field"</b> parameter</p>',
       	'after'        => '<p>Testing <b>"after"</b> parameter</p>',
       	'after_row'    => '<p>Testing <b>"after_row"</b> parameter</p>',
       	'options'     => array(
       		'group_title'   => __( 'Action or Plan {#}', 'odfw' ),
       		'add_button'    => __( 'Add another Local Conservation Action or Plan', 'odfw' ),
       		'remove_button' => __( 'Remove this entry', 'odfw' ),
       		'sortable'      => true, // beta
       		'before_row'   => '<p>Options Testing <b>"before_row"</b> parameter</p>',
       		'before'       => '<p>Options Testing <b>"before"</b> parameter</p>',
       		'before_field' => '<p>Options Testing <b>"before_field"</b> parameter</p>',
       		'after_field'  => '<p>Options Testing <b>"after_field"</b> parameter</p>',
       		'after'        => '<p>Options Testing <b>"after"</b> parameter</p>',
       		'after_row'    => '<p>Options Testing <b>"after_row"</b> parameter</p>',
       		)
       ));
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Text Hover] Matching within HTML Tags](https://wordpress.org/support/topic/matching-within-html-tags/)
 *  Thread Starter [syrupcore](https://wordpress.org/support/users/syrupcore/)
 * (@syrupcore)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/matching-within-html-tags/#post-6703222)
 * Well, I tried this and it seems to be working. I took out the negative look aheads
   and added `>` and `<` to either side main capture. In some brief testing it seems
   to be fine but my Regex Fu is weak enough that I’m not entirely sure what problem
   I’ve just created! Can anyone tell me?
 * Here’s the original:
 *     ```
       $regex = "(?!<.*?)([\s\'\"\.\x98\x99\x9c\x9d\xCB\x9C\xE2\x84\xA2\xC5\x93\xEF\xBF\xBD\(\[\{])($old_text)([\s\'\"\x98\x99\x9c\x9d\xCB\x9C\xE2\x84\xA2\xC5\x93\xEF\xBF\xBD\?\!\.\,\-\+\]\)\}])(?![^<>]*?>)";
       ```
   
 * Here’s the one I’m using:
 *     ```
       $regex = "([\s\>\'\"\.\x98\x99\x9c\x9d\xCB\x9C\xE2\x84\xA2\xC5\x93\xEF\xBF\xBD\(\[\{])($old_text)([\s\<\'\"\x98\x99\x9c\x9d\xCB\x9C\xE2\x84\xA2\xC5\x93\xEF\xBF\xBD\?\!\.\,\-\+\]\)\}])";
       ```
   

Viewing 15 replies - 1 through 15 (of 167 total)

1 [2](https://wordpress.org/support/users/syrupcore/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/syrupcore/replies/page/3/?output_format=md)…
[10](https://wordpress.org/support/users/syrupcore/replies/page/10/?output_format=md)
[11](https://wordpress.org/support/users/syrupcore/replies/page/11/?output_format=md)
[12](https://wordpress.org/support/users/syrupcore/replies/page/12/?output_format=md)
[→](https://wordpress.org/support/users/syrupcore/replies/page/2/?output_format=md)