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 | |
/* | |
Check if protocol is https | |
Nb: port 443 does not guarantee connection is encrypted | |
http://stackoverflow.com/questions/1175096/how-to-find-out-if-you-are-using-https-without-serverhttps#answer-2886224 | |
*/ | |
function isSecure() { | |
return | |
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') | |
|| $_SERVER['SERVER_PORT'] == 443; |
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 my_child_theme_locale() { | |
load_child_theme_textdomain( 'my_child_theme', get_stylesheet_directory() . '/languages' ); | |
} | |
add_action( 'after_setup_theme', 'my_child_theme_locale' ); |
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 countCSSRules() { | |
var results = '', | |
log = ''; | |
if (!document.styleSheets) { | |
return; | |
} | |
for (var i = 0; i < document.styleSheets.length; i++) { | |
countSheet(document.styleSheets[i]); | |
} | |
function countSheet(sheet) { |
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 | |
// include all PHP files in ./lib/ directory: | |
foreach ( glob( dirname( __FILE__ ) . '/lib/*.php' ) as $file ) | |
include $file; | |
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
*/ | |
https://localise.biz/help/wordpress/loading-translations | |
"If WordPress fails to find a MO file at this exact location, it will then look in the global languages directory" | |
So in short, WordPress will look in only two places for a theme's MO file: | |
{absolute_path}/{locale}.mo | |
wp-content/languages/themes/{domain}-{locale}.mo | |
e.g. for twentyfourteen's French translations: |
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 file assumes that you have included the nav walker from https://github.com/twittem/wp-bootstrap-navwalker | |
// somewhere in your theme. | |
?> | |
<header class="banner navbar navbar-default navbar-static-top" role="banner"> | |
<div class="container"> | |
<div class="navbar-header"> | |
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> | |
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span> |
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
// Login log out functionality in menu, add stuff to menu | |
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 ); | |
function add_loginout_link( $items, $args ) { | |
if (is_user_logged_in() && $args->theme_location == 'top_nav') { | |
$items .= '<li><a href="'. wp_logout_url() .'">Log Out</a></li>'; | |
} | |
elseif (!is_user_logged_in() && $args->theme_location == 'top_nav') { | |
$items .= '<li><a href="'. site_url('wp-login.php') .'">Log In</a></li>'; | |
} | |
return $items; |
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
fl.videoLog = { | |
init: function () { | |
console.log('#asdf'); | |
var self = this; | |
$("video[data-ga-logging-name]").on("play", function () { | |
var gaLoggingName = this.dataset.gaLoggingName; | |
fl.videoLog.vars.trackingStatus = 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
init: function () { | |
console.log('#asdf'); | |
var self = this; | |
$("video[data-ga-logging-name]").on("play", function () { | |
var gaLoggingName = this.dataset.gaLoggingName; | |
fl.videoLog.vars.trackingStatus = 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
//Cart | |
//https://github.com/woocommerce/woocommerce/blob/d30c54ef846b086b96278375b71f7c379d9aa8e8/assets/js/frontend/cart.js | |
$( document.body ).on( 'update_checkout', function(){}); | |
$( document.body ).on( 'updated_cart_totals', function(){}); | |
$( document.body ).on( 'updated_wc_div', function(){}); | |
$( document.body ).on( 'updated_shipping_method', function(){}); | |
$( document.body ).on( 'applied_coupon', function(){}); | |
$( document.body ).on( 'removed_coupon', function(){}); | |
// Checkout |
OlderNewer