Find attributes by name.
function my_find_attribute_by_name( $name, $attribute ) {
global $wpdb;
$term_table = $wpdb->prefix . 'terms';
$taxonomy_table = $wpdb->prefix . 'term_taxonomy';
if ( ! empty( $name ) ) {Find attributes by name.
function my_find_attribute_by_name( $name, $attribute ) {
global $wpdb;
$term_table = $wpdb->prefix . 'terms';
$taxonomy_table = $wpdb->prefix . 'term_taxonomy';
if ( ! empty( $name ) ) {| $fontPath: '../../fonts'; | |
| @mixin fonts($name, $file, $fontWeight) { | |
| @font-face { | |
| font-family: $name; | |
| src: url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.eot'); | |
| src: url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.eot?#iefix') format('embedded-opentype'), | |
| url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.woff2') format('woff2'), | |
| url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.woff') format('woff'), | |
| url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.ttf') format('truetype'), |
This shows how to save a custom log of imported items. It can be adjusted to include any product data.
/***********************************************/
/***** BEGIN LOG CREATE / UPDATE / DELETE *****/
/********************************************* */
// This creates a custom log file in the root WordPress uploads folder
// Some of this code will need to be adjusted, please read comments.| <?php // wp-content/mu-plugins/ga4.php - GA4 tracker boilerplate. | |
| define('GA_NOT_LIVE', true); // remove for go | |
| define('GA4_MEASUREMENT_ID', 'G-XXXXXXXXXX'); // required | |
| define('UA_PROPERTY_ID', 'UA-XXXXXXX-YY'); // optional | |
| define('GA_ANONYMIZE_IP', true); // optional | |
| define('GA_TRACK_ADMINS', false); // optional, defaults to true | |
| define('GA_TRACK_EDITORS', false); // optional, defaults to true | |
| // we need GA as first thing in the body |
| const axios = require('axios') | |
| // This is the interface/object for communicating with GA4MP | |
| export function GA4MPClient(apiSecret, measurementId, clientId) { | |
| // Vars for GA4 connection | |
| this.API_SECRET = apiSecret; // GA > Admin > Data Streams > choose your stream > Measurement Protocol > Create | |
| this.MEASUREMENT_ID = measurementId; // GA Admin > Data Streams > choose your stream > Measurement ID |
| #!/bin/bash | |
| FILE=wp-config.php | |
| for d in */; do | |
| # Just... yeah | |
| if [ "$d" != "ottersbusinesshub.co.uk/" ]; then | |
| if [ "$d" != "lilymaehomecare.com/" ]; then | |
| echo "" | |
| echo "Entering $d..." |
This example snippet assumes you're importing variations with a "color" attribute. You will need to adjust it if that's not the case for your products.
function wpai_image_imported( $post_id, $att_id, $filepath, $is_keep_existing_images = '' ) {
$product = wc_get_product( $post_id );
if ( ! $product ) return;
$parent_id = $product->get_parent_id();
if ( empty( $parent_id ) ) return;
$parent = wc_get_product( $parent_id );
if ( ! $parent ) return;| ############ WordPress #################### | |
| # Disable logging for favicon and robots.txt | |
| location = /favicon.ico { | |
| try_files /favicon.ico @empty; | |
| access_log off; | |
| log_not_found off; | |
| expires max; | |
| } |
| <#PSScriptInfo | |
| .AUTHOR | |
| Martin Palmowski | |
| .SYNPOSIS | |
| Backup settings and configs for my Windows 10 environment. | |
| .DESCRIPTION | |
| Backup the most relevant settings and configs in a 7-zip archive. | |
| Requires 7-zip to be installed an in the path. | |
| Paths are based on Windows 10 defaults. | |
| #> |