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( 'ajax_query_attachments_args', 'filter_query_attachments_args' ); | |
function filter_query_attachments_args( $query ) { | |
// 1. Only users with access | |
if ( ! current_user_can( 'upload_files' ) ) { | |
wp_send_json_error(); | |
} | |
// 2. No manipulation for admins. | |
// After all they have access to all images. |
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 | |
$url = "https://wordpress.org/latest.zip"; // URL of what you wan to download | |
$zipFile = "wordpress.zip"; // Rename .zip file | |
$extractDir = "extracted"; // Name of the directory where files are extracted | |
$zipResource = fopen($zipFile, "w"); | |
// Get The Zip File From Server | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_FAILONERROR, 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
<form action="/cart/add" method="post"> | |
{% if product.variants.size > 1 %} | |
{% if product.options[0] %} | |
{% assign used = '' %} | |
<label for="select-one">{{ product.options[0] }}</label> | |
<select id='select-one' onchange="letsDoThis()"> | |
{% for variant in product.variants %} | |
{% unless used contains variant.option1 %} | |
<option value="{{ variant.option1 }}">{{ variant.option1 }}</option> | |
{% capture used %}{{ used }} {{ variant.option1 }}{% endcapture %} |
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 is for easily deploying updates to Github repos to your local server. It will automatically git clone or | |
* git pull in your repo directory every time an update is pushed to your $BRANCH (configured below). | |
* | |
* Read more about how to use this script at http://behindcompanies.com/2014/01/a-simple-script-for-deploying-code-with-githubs-webhooks/ | |
* | |
* INSTRUCTIONS: | |
* 1. Edit the variables below | |
* 2. Upload this script to your server somewhere it can be publicly accessed |
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
{% comment %} | |
Input | |
{% endcomment %}{% capture _content %}{{ content }}{% endcapture %}{% comment %} | |
Remove redundant closing tags | |
{% endcomment %}{% assign _endings = "html head body li dt dd p rt rp optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% for _element in _endings %} | |
{% capture _end %}</{{ _element }}>{% endcapture %} |
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 | |
//returns a big old hunk of JSON from a non-private IG account page. | |
function scrape_insta($username) { | |
$insta_source = file_get_contents('http://instagram.com/'.$username); | |
$shards = explode('window._sharedData = ', $insta_source); | |
$insta_json = explode(';</script>', $shards[1]); | |
$insta_array = json_decode($insta_json[0], TRUE); | |
return $insta_array; | |
} |
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
{% comment %} | |
This file can be added as a snippet and add it anywhere you want to display | |
{% endcomment %} | |
<div id="pageheader"> | |
<div class="util-area"> | |
<div class="search-box"> | |
<form class="search-form" action="/search" method="get" _lpchecked="1"> | |
<i class="icon-mag"></i> | |
<input type="text" name="q" placeholder="Search" autocomplete="off"> | |
<input type="submit" value="→"> |
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
<script> | |
// (c) Copyright 2016 Caroline Schnapp. All Rights Reserved. Contact: mllegeorgesand@gmail.com | |
// See https://docs.shopify.com/themes/customization/navigation/link-product-options-in-menus | |
// Modified by Jonathan Moore (Style Hatch) https://github.com/jonathanmoore | |
/* | |
Updated to work with sectioned themes | |
- Added required methods from the deprecated options_selection.js | |
- Triggers an initial variant change | |
- Hides sold out variants with only one option |
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
/** | |
* WP CLI custom command to export a form submsissions from Ninja Forms | |
* The to_csv function will create a 'reports' directory | |
* if it does not exist and create a datetime stamped csv | |
* | |
* ## OPTIONS | |
* | |
* <id> | |
* : The form id. | |
* <send_to_sftp> |
OlderNewer