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 type="text/javascript"> | |
var storefront_items_stock = {}; | |
<? | |
var storefront = DB.getObjects('store_item'); | |
for each (item in storefront) { | |
print('storefront_items_stock['); | |
print( item.store_item_KEY ); | |
print( '] = ' ); | |
print( item.Number_in_Stock ); | |
print( ';\n'); |
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
# Change the upload path of the sites to make sure media files still work | |
SELECT * FROM wpdb_6_options WHERE option_name IN ('upload_path', 'upload_url_path'); |
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
sudo nginx -s reload | |
sudo service php7.0-fpm restart |
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
git ls-files -u |
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
/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/ |
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
// List from https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements | |
@mixin block-elements($context: '') { | |
#{$context} address, | |
#{$context} article, | |
#{$context} aside, | |
#{$context} blockquote, | |
#{$context} canvas, | |
#{$context} dd, | |
#{$context} div, |
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 | |
/** | |
* Add the widget ID and widget name as HTML comments. | |
* | |
* Makes it easiser to identify exactly which widget area a widget is appearing in. | |
* This helps a lot with themes that have a lot of sidebars and uses a lot of widgets. | |
*/ | |
function which_dynamic_sidebar( $sidebar_params ) { | |
$sidebar_params['0']['class'] = empty( $sidebar_params['0']['class'] )?$sidebar_params['0']['id']:$sidebar_params['0']['class'].' '.$sidebar_params['0']['id']; | |
$sidebar_params['0']['before_widget'] = '<!--Widget-Area:id:'.esc_attr($sidebar_params['0']['id']).';name:'.esc_attr($sidebar_params['0']['name']).'-->'.$sidebar_params['0']['before_widget']; |
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 | |
/** | |
* Enable Jetpack development mode if WP_DEBUG is true and jetpack is not active/connected to WordPress.com | |
* See: https://jetpack.com/support/development-mode/ | |
*/ | |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { | |
if ( method_exists( '\\Jetpack', 'is_active' ) && is_callable( array( '\\Jetpack', 'is_active' ) ) ) { | |
$jetpack_reflection = new \ReflectionMethod( '\\Jetpack', 'is_active' ); |
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 | |
// Detect if the content contains any Facebook links that can be embedded based on this doc | |
// https://developers.facebook.com/docs/plugins/oembed-endpoints/ | |
$content = 'https://www.facebook.com/facebook/videos/10153231379946729/'; | |
preg_match_all( '/http(s):\/\/(www.)facebook.com\/((?<=\/).+(?<=\/)posts|(?<=\/).+(?<=\/)activity|photo(s|\.php)|permalink\.php|media|questions|notes|(?<=\/).+(?<=\/)videos|video\.php)/', $content, $matches ); |
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 | |
$url = 'https://insert-domain-here.com/api-endpoint'; | |
// The file is stored on your system/host | |
$path_to_uploaded_file = '/full-path-to-file/picture.jpg'; | |
$form_fields = [ 'first_name' => 'Foo', 'last_name' => 'Bar' ]; | |
if ( file_exists( $path_to_uploaded_file ) ) { | |
$form_fields['profile_picture'] = new CurlFile( $path_to_uploaded_file ); | |
} | |
/* |