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 | |
//don't add again | |
// assumes that you have registered your js for the new lightbox and that you understand what a handle is. | |
// Gallery Support | |
add_theme_support( 'wc-product-gallery-zoom' ); | |
add_theme_support( 'wc-product-gallery-slider' ); | |
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
// Modify single product images: add carousel functionality | |
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); | |
add_action( 'woocommerce_before_single_product_summary', function(){ | |
global $product; | |
$image_ids = []; | |
// featured image | |
if( has_post_thumbnail() ) $image_ids[] = get_post_thumbnail_id(); |
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 your Google Fonts here. | |
* This is specifically for the theme Sage from roots.io and goes in config.php | |
* Change the font name, weights and styles to what you are using as needed. | |
*/ | |
define('GOOGLE_FONTS', 'Oswald:400,300,700:latin'); |
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
# Find the largest tables in your MySQL database | |
SELECT | |
table_name as "Table", | |
table_rows as "Rows", | |
data_length as "Length", | |
index_length as "Index", | |
round(((data_length + index_length) / 1024 / 1024),2) as "Size (mb)" | |
FROM information_schema.TABLES | |
WHERE table_schema = "%%YOURDATABASE%%" | |
ORDER BY `Size (mb)` DESC |
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 custom_read_more() { | |
return '... <a class="read-more" href="'.get_permalink(get_the_ID()).'">more »</a>'; | |
} | |
function excerpt($limit) { | |
return wp_trim_words(get_the_excerpt(), $limit, custom_read_more()); | |
} |
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 one line alias into your .bash_profile, then you are done: | |
alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl' | |
use: | |
subl [YOUR_FILE_PATH_TO_OPEN] |
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 fadeOut(el){ | |
el.style.opacity = 1; | |
(function fade() { | |
if ((el.style.opacity -= .1) < 0) { | |
el.style.display = "none"; | |
} else { | |
requestAnimationFrame(fade); | |
} | |
})(); |
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
# ----------------------------------------------------------------- | |
# .gitignore for WordPress @salcode | |
# ver 20180808 | |
# | |
# From the root of your project run | |
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore | |
# to download this file | |
# | |
# By default all files are ignored. You'll need to whitelist | |
# any mu-plugins, plugins, or themes you want to include in the repo. |
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 custom_field_excerpt($text, $words) { | |
global $post; | |
//$text = get_field('your_field_name'); //Replace 'your_field_name' | |
if ( '' != $text ) { | |
$text = strip_shortcodes( $text ); | |
$text = apply_filters('the_content', $text); | |
$text = str_replace(']]>', ']]>', $text); | |
$excerpt_length = $words; // 20 words | |
$excerpt_more = apply_filters('excerpt_more', ' foobar' . '[...]'); | |
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more ); |
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
/** | |
* Bulma Tabs Walker Subnav | |
*/ | |
add_filter('nav_menu_css_class' , __NAMESPACE__ .'\special_nav_class' , 10 , 2); | |
function special_nav_class($classes, $item){ | |
if( in_array('current-menu-item', $classes) ){ | |
$classes[] = 'is-active '; | |
} | |
return $classes; | |
} |