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
// Hook into 'init' to start processing reviews | |
add_action('init', 'schedule_review_approval'); | |
// Function to schedule the review approval process | |
function schedule_review_approval() { | |
if (current_user_can('administrator') && !wp_next_scheduled('approve_reviews_batch')) { | |
// Schedule an event to run immediately, and repeat it every 30 seconds | |
wp_schedule_single_event(time(), 'approve_reviews_batch'); | |
} | |
} |
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
// Imports | |
const { render } = wp.element // <--- Wordpressify React | |
import { FaTwitter, FaFacebookF, FaWhatsapp } from 'react-icons/fa'; | |
// Variables for the share button | |
const shareText = encodeURIComponent( "Check this out!~" ) | |
const shareUrl = window.location.href | |
const hashTags = "Hashtag,Awesome,Cool" | |
const params = "menubar=no,toolbar=no,status=no,width=570,height=570" // for window |
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 custom_woocommerce_auto_complete_order( $order_id ) { | |
if ( ! $order_id ) { | |
return; | |
} | |
$order = wc_get_order( $order_id ); | |
$product_ids = array('12'); // Here set your targeted product(s) Id(s) | |
$product_found = true; |
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
DELETE a,c FROM wp_terms AS a | |
LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id | |
LEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id | |
WHERE c.taxonomy = 'product_tag'; | |
DELETE a,c FROM wp_terms AS a | |
LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id | |
LEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id | |
WHERE c.taxonomy = 'product_cat'; |
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
// # Changes how we use querySelector, querySelectorAll, addEventListener, and removeEventListener. | |
const $ = () => document.querySelector.call(this, arguments); | |
const $$ = () => document.querySelectorAll.call(this, arguments); | |
HTMLElement.prototype.on = (a, b, c) => this.addEventListener(a, b, c); | |
HTMLElement.prototype.off = (a, b) => this.removeEventListener(a, b); | |
// And therefore we can use this like... | |
let nav = $("nav"); | |
// rather than... | |
let nav = document.querySelector("nav"); |
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 | |
// Example setting some image sizes | |
add_image_size( 'hero', 1900, 940 ); | |
add_image_size( 'square-large', 1200, 1200, true ); | |
add_image_size( 'square', 600, 600, true ); | |
add_image_size( 'featured-large', 2280, 860, true ); | |
add_image_size( 'featured', 1140, 430, true ); | |
add_image_size( 'image-block', 1140, 430, false ); | |
add_image_size( 'teaser-large', 720, 480, true ); | |
add_image_size( 'teaser', 360, 240, true ); |