First create global variables (in functions.php or as a mu-plugin):
<?php
/*
* CUSTOM GLOBAL VARIABLES
*/
function wtnerd_global_vars() {| window.mobileCheck = function() { | |
| let check = false; | |
| (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v |
| <?php | |
| /** scoll on loaded only if pager is the change in facet **/ | |
| add_action( 'wp_head', function() { ?> | |
| <script> | |
| (function($) { | |
| $(document).on('facetwp-refresh', function() { | |
| if ( FWP.soft_refresh == true ) { | |
| FWP.enable_scroll = true; |
| <?php | |
| /** | |
| * Plugin Name: Gulp Sitemap Generator | |
| * Plugin URI: https://gladdy.uk/blog/2014/04/13/using-uncss-and-grunt-uncss-with-wordpress/ | |
| * Description: Generate a JSON list of every page on a site so it can be used with Gulp and uncss. | |
| * Author: Liam Gladdy | |
| * Author URI: http://gladdy.co.uk | |
| * Version: 1.0 | |
| */ |
| // Alerts | |
| @include alert-variant($background, $border, $text-color); | |
| // Background Variant | |
| @include bg-variant($parent, $color); | |
| // Border Radius | |
| @include border-top-radius($radius); | |
| @include border-right-radius($radius); | |
| @include border-bottom-radius($radius); |
| <style> | |
| .social-revealer { | |
| position: relative; | |
| display: inline-block; | |
| width: 200px; | |
| height: 35px; | |
| max-width: 100%; | |
| background: #eee; | |
| padding-left: 36px; | |
| margin-bottom: 0px; |
First create global variables (in functions.php or as a mu-plugin):
<?php
/*
* CUSTOM GLOBAL VARIABLES
*/
function wtnerd_global_vars() {| $(function() { | |
| var slider, // Global slider value to force playing and pausing by direct access of the slider control | |
| canSlide = true; // Global switch to monitor video state | |
| // Load the YouTube API. For some reason it's required to load it like this | |
| var tag = document.createElement('script'); | |
| tag.src = "//www.youtube.com/iframe_api"; | |
| var firstScriptTag = document.getElementsByTagName('script')[0]; | |
| firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | |
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Bootstrap Masonry Template</title> | |
| <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
| <link rel="stylesheet" href="style.css"> | |
| <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700"> |
| // get the content | |
| @ob_start(); | |
| $writer = PHPExcel_IOFactory::createWriter($excel, "Excel2007"); | |
| $writer->save("php://output"); | |
| $data = @ob_get_contents(); | |
| @ob_end_clean(); | |
| // set email attachment |
| <?php | |
| // Inspired by a snippet by Justin Tadlock (http://justintadlock.com/) posted here: http://elliotjaystocks.com/blog/tutorial-multiple-singlephp-templates-in-wordpress/#comment-2383 | |
| add_filter( 'category_template', 'my_category_template' ); | |
| // I believe *_template hooks exist for just about every type of template so it's easy to apply to other templates as well | |
| function my_category_template( $template ) { | |
| if( is_category( 1 ) ) // We can search for categories by ID | |
| $template = locate_template( array( 'template_id_A.php', 'category.php' ) ); |