This file contains hidden or 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
wp post list --field=ID --post_type=product --posts_per_page=2000 | xargs wp post delete --force | |
Delete from trash: | |
wp post list --field=ID --post_type=product --post_status=trash --posts_per_page=2000 | xargs wp post delete --force |
This file contains hidden or 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
function remove_default_category($ID, $post) { | |
//get all categories for the post | |
$categories = wp_get_object_terms($ID, 'category'); | |
//if there is more than one category set, check to see if one of them is the default | |
if (count($categories) > 1) { | |
foreach ($categories as $key => $category) { | |
//if category is the default, then remove it | |
if ( $category->name === "Uncategorized") { |
This file contains hidden or 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
const newString = JSON.parse(str.replace(/(\{|,)\s*(.+?)\s*:/g, '$1 "$2":')) |
This file contains hidden or 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
<script src="https://unpkg.com/[email protected]/dist/smoothscroll.js"></script> | |
<div | |
x-data="{ | |
skip: 3, | |
next() { | |
this.to((current, offset) => current + (offset * this.skip)) | |
}, | |
prev() { | |
this.to((current, offset) => current - (offset * this.skip)) |
This file contains hidden or 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
<div x-data="{ active: 1 }" class="space-y-4"> | |
<div x-data="{ | |
id: 1, | |
get expanded() { | |
return this.active === this.id | |
}, | |
set expanded(value) { | |
this.active = value ? this.id : null | |
}, | |
}" role="region" class="border border-black"> |
This file contains hidden or 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
# This is a basic workflow to help you get started with Actions | |
name: Build & Deploy to Staging (DO) | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ staging ] | |
pull_request: |
This file contains hidden or 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 | |
/** | |
* | |
* Adds location rule to target specific sites in a WordPress Multisite environment | |
* http://www.advancedcustomfields.com/resources/custom-location-rules/ | |
* | |
*/ | |
function acf_location_rule_type_blog( $choices ) { |
This file contains hidden or 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( 'woocommerce_product_add_to_cart_text', function( $text ) { | |
global $product; | |
if ( $product->is_type( 'variable' ) ) { | |
$text = $product->is_purchasable() ? __( 'Custom options text', 'woocommerce' ) : __( 'Read more', 'woocommerce' ); | |
} | |
return $text; | |
}, 10 ); |
This file contains hidden or 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
/** | |
* Set Ordinal Numbers | |
* | |
* @param [type] $number | |
* @return void | |
*/ | |
function ordinal($number) { | |
$ends = array('th','st','nd','rd','th','th','th','th','th','th'); | |
if ((($number % 100) >= 11) && (($number%100) <= 13)) |
This file contains hidden or 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
# It will solve the too many redirects issue | |
define('FORCE_SSL_ADMIN', true); | |
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') | |
$_SERVER['HTTPS']='on'; |
NewerOlder