Instance | Branch |
---|
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 | |
// Paste everything below this line to your child-theme's functions.php file. | |
// Rounds up all shipping rates by the $roundUpBy value. | |
// After pasting this snippet, reset the WooCommerce shipping cache, e.g. add an item to the cart. | |
add_filter('woocommerce_package_rates', function ($rates, $package) { | |
$roundUpBy = 5; | |
foreach ($rates as $rate) { | |
$rate->cost = ceil($rate->cost / $roundUpBy) * $roundUpBy; | |
} |
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 | |
// only copy the opening php tag if needed | |
// Change the shop / product prices if a unit_price is set | |
function sv_change_product_html( $price_html, $product ) { | |
$unit_price = get_post_meta( $product->id, 'unit_price', true ); | |
if ( ! empty( $unit_price ) ) { | |
$price_html = '<span class="amount">' . wc_price( $unit_price ) . ' per kg</span>'; | |
} |
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 parseVideo (url) { | |
// - Supported YouTube URL formats: | |
// - http://www.youtube.com/watch?v=My2FRPA3Gf8 | |
// - http://youtu.be/My2FRPA3Gf8 | |
// - https://youtube.googleapis.com/v/My2FRPA3Gf8 | |
// - Supported Vimeo URL formats: | |
// - http://vimeo.com/25451551 | |
// - http://player.vimeo.com/video/25451551 | |
// - Also supports relative URLs: | |
// - //player.vimeo.com/video/25451551 |
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 | |
// Show Yoast’s “Primary” Category. Fallback to first category. | |
$category = get_the_category(); | |
$usecatlink = true; | |
// If post has a category assigned. | |
if ( $category ) { | |
$category_display = ''; | |
$category_link = ''; | |
if ( class_exists( 'WPSEO_Primary_Term' ) ) { | |
// Show the post's 'Primary' category, if this Yoast feature is available, & one is set. |
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 | |
/* | |
* Paginate Advanced Custom Field repeater | |
*/ | |
if( get_query_var('page') ) { | |
$page = get_query_var( 'page' ); | |
} else { | |
$page = 1; | |
} |
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
/** | |
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units | |
* | |
* To overcome this, create media queries that target the width, height, and orientation of iOS devices. | |
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing | |
* the height of element `.foo` —which is a full width and height cover image. | |
* | |
* iOS Resolution Quick Reference: http://www.iosres.com/ | |
*/ | |
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 | |
/** | |
* The purpose of this file is to show how a theme can have multiple textdomains | |
* and still work with a single translation file. Translation tools like the | |
* one used on WordPress.org and Poedit are going to simply scan the project for | |
* text strings, regardless of the textdomain (and for good reasons that are | |
* not relevant here). | |
* | |
* The code below works with that system. It assumes that we have a single MO | |
* file based on the theme's textdomain. So, how can two textdomains work? It |
This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.
This is accurate as of WordPress 4.8, and includes some upcoming changes in WordPress 4.9.
There are a few TODOs left. Please bear with me.
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
/** | |
* Style for WP Subscribe | |
* to match Themelia theme | |
* | |
* (NOTE: remove <br> and <span> tags from widget -> Labels -> Title) | |
*/ | |
.widget #wp-subscribe { | |
background-color: rgba(34, 34, 42, .055); | |
padding: 1.5rem; |
NewerOlder