const Moment = require('moment')
const array = [{date:"2018-05-11"},{date:"2018-05-12"},{date:"2018-05-10"}]
const sortedArray = array.sort((a,b) => new Moment(a.date).format('YYYYMMDD') - new Moment(b.date).format('YYYYMMDD'))
console.log(sortedArray)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WooCommerce Custom Checkout Fields | |
* Description: Add some custom "emergency level" extra fields on the WooCommerce Checkout page. Save this custom data in each order metadata. | |
* Author: Pierre Saïkali | |
* Author URI: https://saika.li | |
* Text Domain: wc_ccf | |
* Domain Path: /languages/ | |
* Version: 1.0.0 | |
* Full Tutorial: https://mosaika.fr/personnaliser-tunnel-commande-woocommerce/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: bacs-to-pending-payment | |
Description: Change bank transfer default order status from on Hold to pending payment | |
Version: 1.0.0 | |
Contributors: Suherman Ng | |
Author: Suherman NG | |
Author URI: | |
License: GPLv2 or later | |
Text Domain: CAF website |
Steps to publish a npm package to beta that won't be available via latest and won't auto install on ncu updates etc
- Ensure any compile is run
npm run dist
etc - Modify version in package.json to the following format (match with existing verion numbers etc)
"version": "0.1.120-beta.1"
where beta.x is the number of those betas - Publish to npm
npm publish --tag beta
There are two options for install:
- Always install beta with
npm install packagename@beta
- Install specific version with
npm install [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Custom Registration Fields | |
Plugin URI: | |
Description: | |
Version: 0.1 | |
Author: CSSIgniter | |
Author URI: | |
License: GPLv2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... | |
function woo_payment_gateway() { | |
class Woo_PayPal_Gateway extends WC_Payment_Gateway { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Custom_My_Account_Endpoint { | |
/** | |
* Custom endpoint name. | |
* | |
* @var string | |
*/ | |
public static $endpoint = 'my-custom-endpoint'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter | |
add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' ); | |
function add_my_custom_product_data_tab( $product_data_tabs ) { | |
$product_data_tabs['my-custom-tab'] = array( | |
'label' => __( 'My Custom Tab', 'my_text_domain' ), | |
'target' => 'my_custom_product_data', | |
); | |
return $product_data_tabs; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add the field to the Add New Category page | |
add_action( 'category_add_form_fields', 'pt_taxonomy_add_new_meta_field', 10, 2 ); | |
function pt_taxonomy_add_new_meta_field() { | |
// this will add the custom meta field to the add new term page | |
?> | |
<div class="form-field"> | |
<label for="term_meta[cat_icon]"><?php _e( 'Font Awesome Icons', 'pt' ); ?></label> | |
<input type="text" name="term_meta[cat_icon]" id="term_meta[cat_icon]" value=""> |
NewerOlder