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
# Based on this answer: https://stackoverflow.com/a/61859561/1956278 | |
# Backup old data | |
Rename-Item -Path "./data" -NewName "./data_old" | |
# Create new data directory | |
Copy-Item -Path "./backup" -Destination "./data" -Recurse | |
Remove-Item "./data/test" -Recurse | |
$dbPaths = Get-ChildItem -Path "./data_old" -Exclude ('mysql', 'performance_schema', 'phpmyadmin') -Recurse -Directory | |
Copy-Item -Path $dbPaths.FullName -Destination "./data" -Recurse |
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
add_filter( 'graphql_PostObjectsConnectionOrderbyEnum_values', function( $values ) { | |
$values['LIKE_COUNT'] = [ | |
'value' => 'like_count', | |
'description' => __( 'The number of likes on the post', 'wp-graphql' ), | |
]; | |
return $values; | |
} ); |
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
// check version | |
node -v || node --version | |
// list locally installed versions of node | |
nvm ls | |
// list remove available versions of node | |
nvm ls-remote | |
// install specific version of node |
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
" Don't try to be vi compatible | |
set nocompatible | |
" Helps force plugins to load correctly when it is turned back on below | |
filetype off | |
" TODO: Load plugins here (pathogen or vundle) | |
" Turn on syntax highlighting | |
syntax on |
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
// Render fields at the bottom of variations - does not account for field group order or placement. | |
add_action( 'woocommerce_product_after_variable_attributes', function( $loop, $variation_data, $variation ) { | |
global $abcdefgh_i; // Custom global variable to monitor index | |
$abcdefgh_i = $loop; | |
// Add filter to update field name | |
add_filter( 'acf/prepare_field', 'acf_prepare_field_update_field_name' ); | |
// Loop through all field groups | |
$acf_field_groups = acf_get_field_groups(); | |
foreach( $acf_field_groups as $acf_field_group ) { |
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 | |
/* | |
This script will allow you to send a custom email from anywhere within wordpress | |
but using the woocommerce template so that your emails look the same. | |
Created by [email protected] on 27th of July 2017 | |
Put the script below into a function or anywhere you want to send a custom email | |
*/ |
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
/** | |
* Disable new divi crazy crap code for CPT | |
**/ | |
function disable_cptdivi() | |
{ | |
remove_action( 'wp_enqueue_scripts', 'et_divi_replace_stylesheet', 99999998 ); | |
} | |
add_action('init', 'disable_cptdivi'); |
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 $attributes = $product->get_attributes() // GET ALL ATRIBUTES ?> | |
<?php foreach( $attributes as $key => $value ): ?> | |
<?php $attribute_name = preg_replace( '/pa_/', '', $key ) // GET ATTRIBUTE NAME ?> | |
<label> | |
<select name="attribute_pa_<?php echo $attribute_name ?>" id="attribute_pa_<?php echo $attribute_name ?>"> | |
<option value=""><?php echo $attribute_name ?></option> | |
<?php $attribute_name = wc_get_product_terms( get_the_ID(), $key ) // GET ATTRIBUTE NAME ?> | |
<?php $attribute_slug = wc_get_product_terms( get_the_ID(), $key, array( 'fields' => 'slugs' ) ) // GET ATTRIBUTE SLUG ?> | |
<?php for ( $i=0; $i<count( $attribute_name ); $i++ ): // array_slice BECAUSE ARRAY INDEX IS NOT SEQUENCIAL ?> | |
<option value="<?php $slug = array_slice( $attribute_slug, $i, 1 ); echo $slug[0]; ?>"><?php $name = array_slice( $attribute_name, $i, 1 ); echo $name[0]; ?></option> |