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
var getWPJRA = function( baseUrl, child , callback){ | |
if (baseUrl !== undefined ){ | |
switch( child ) { | |
case undefined: | |
return jQuery.getJSON( '/' + baseUrl + "/wp-json" , callback); | |
break; | |
default: | |
return jQuery.getJSON( '/' + baseUrl + "/wp-json/" + child, callback); | |
} | |
} else if (baseUrl === undefined || baseUrl.length == 0) { |
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 add_countries(){ | |
$country_array = array( | |
"afg" => "Afghanistan", | |
"alb" => "Albania", | |
"dza" => "Algeria", | |
"and" => "Andorra", | |
"ago" => "Angola", | |
"atg" => "Antigua and Barbuda", | |
"arg" => "Argentina", | |
"arm" => "Armenia", |
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
add_action( 'pre_get_posts', 'ml_restrict_media_library' ); | |
function ml_restrict_media_library( $wp_query_obj ) { | |
global $current_user, $pagenow; | |
if (!in_array( 'administrator', $current_user->roles )){ | |
if( !is_a( $current_user, 'WP_User') ) | |
return; | |
if( 'admin-ajax.php' != $pagenow || $_REQUEST['action'] != 'query-attachments' ) |
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
var mobileManager = function (mobile, desktop, breakpoint) { | |
//Defaults to 767, not much desktop running below that right now isn't it? | |
var _breakpoint = breakpoint || 767; | |
//Defaults to function, we need to invoke this later | |
var _desktop = desktop || function () {}; | |
var _mobile = mobile || function () {}; | |
//Counter to see where we are right now |
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
@charset "UTF-8"; | |
@import "https://fonts.googleapis.com/css?family=Oswald"; | |
* { | |
animation: fadeIn 1s; | |
} | |
a { | |
transition: 250ms; | |
} |
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 ($) { | |
$.fn.dump = function (variable) { | |
this.html($('<pre></pre>') | |
.text(JSON.stringify(variable, null, 4))); | |
return this; | |
}; | |
})(jQuery); | |
//How to use: | |
/* |
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
document.getElementById('menu-button').onclick = function() { | |
document.getElementsByTagName('header')[0].classList.toggle('menu-open'); | |
document.querySelector('div.content').classList.toggle('menu-open'); | |
document.querySelector('nav').classList.toggle('menu-open'); | |
return false; | |
}; |
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 | |
$request = http_build_query($_GET); | |
$server = 'HTTP://YOURSERVERAJAXENDPOINT'; | |
function getCurrentUri(){ | |
$basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/'; | |
$uri = substr($_SERVER['REQUEST_URI'], strlen($basepath)); | |
if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?')); | |
$uri = '/' . trim($uri, '/'); |
OlderNewer