$ git checkout --orphan svn$ svn co https://plugins.svn.wordpress.org/search-by-algolia-instant-relevant-results/ .| // @see number to string, pluginized from http://stackoverflow.com/questions/5529934/javascript-numbers-to-words | |
| // @see http://stackoverflow.com/questions/20425771/how-to-replace-1-with-first-2-with-second-3-with-third-etc | |
| const convert = function (num) { | |
| return num2str.convert(num); | |
| } | |
| const num2str = {} | |
| num2str.ones=['','one','two','three','four','five','six','seven','eight','nine']; | |
| num2str.tens=['','','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety']; |
| #!/usr/bin/env node | |
| var algoliasearch = require('algoliasearch'); | |
| const APP_ID = 'whatever'; | |
| const API_KEY = 'whatever'; | |
| const INDEX_NAME = "test"; | |
| var client = algoliasearch(APP_ID, API_KEY); | |
| var index = client.initIndex(INDEX_NAME); |
| <?php | |
| /** | |
| * @wordpress-plugin | |
| * Plugin Name: Search by Algolia for WooCommerce - Instant & Relevant results | |
| */ | |
| /** | |
| * If Algolia is not active, let users know. |
| search.addWidget({ | |
| init: function() { | |
| $('.clear-search-icon').on('click', function() { | |
| search.helper.setQuery(''); | |
| search.helper.search(); | |
| }); | |
| }, | |
| render: function(results) { | |
| var clearIcon = $('.clear-search-icon'); | |
| if(results.state.query.length === 0) { |
| <?php | |
| /** | |
| * @param array $shared_attributes | |
| * | |
| * @return array | |
| */ | |
| function custom_post_shared_attributes( array $shared_attributes) { | |
| $shared_attributes['permalink'] = str_replace( 'cms.', 'www.', $shared_attributes['permalink'] ); |
| <?php | |
| /** | |
| * @param array $shared_attributes | |
| * | |
| * @return array | |
| */ | |
| function custom_post_shared_attributes( array $shared_attributes ) { | |
| $shared_attributes['permalink'] = str_replace( 'cms.', 'www.', $shared_attributes['permalink'] ); |
| /* global instantsearch */ | |
| var search = instantsearch({ | |
| // ... | |
| searchParameters: { | |
| filters: 'wpml.language_code:"' + icl_lang + '"' | |
| } | |
| // ... | |
| }); |
| <?php | |
| add_filter( 'woocommerce_catalog_orderby', function( $wc_options ) { | |
| $remove_sort_options = array( | |
| 'popularity', | |
| 'rating', | |
| 'date', | |
| 'price', | |
| 'price-desc', | |
| ); |