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 remove_http($url) { | |
$disallowed = array('http://', 'https://'); | |
foreach($disallowed as $d) { | |
if(strpos($url, $d) === 0) { | |
return str_replace($d, '', $url); | |
} | |
} | |
return $url; | |
} |
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
// --------------------------------------------------------- | |
// Back to Top | |
// --------------------------------------------------------- | |
$(window).scroll(function () { | |
if ($(this).scrollTop() > 100) { | |
$('#back-top').fadeIn(); | |
} else { | |
$('#back-top').fadeOut(); | |
} | |
}); |
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
<section class="section"> | |
<header class="section--header"> | |
<div class="container"> | |
<h1 class="section--title">Section Title</h1> | |
</div> | |
</header> | |
<main class="section--content"> | |
<div class="container"> | |
<!-- ... --> | |
</div> |
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
$http({ | |
method: 'JSONP', | |
url: $sce.trustAsResourceUrl(url), | |
jsonpCallbackParam: 'callback' | |
}) | |
.then(function(response) { | |
console.log(response); | |
}); |
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 settings = { | |
"async": true, | |
"crossDomain": true, | |
"url": "http://www.marcelo-ribeiro.tk/wp-json/wp/v2/media/48", | |
"method": "POST", | |
"headers": { | |
"authorization": "Basic bWFyY2Vsb3JpYmVpcm86QDg1ODM1OTU0Iw==", | |
"content-type": "application/json" | |
}, | |
"processData": 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
// Access-Control-Allow-Origin | |
add_action( 'rest_api_init', function() { | |
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); | |
add_filter( 'rest_pre_serve_request', function( $value ) { | |
$origin = get_http_origin(); | |
if ( $origin && in_array( $origin, array( | |
'http://localhost' | |
) ) ) { | |
header( 'Access-Control-Allow-Origin: ' . esc_url_raw( $origin ) ); | |
header( 'Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE' ); |
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
$args = [ | |
'taxonomy' => 'category', | |
'hide_empty' => 0, | |
'parent' => 0 | |
]; | |
function _get_child_terms( $items ) { | |
foreach ( $items as $item ) { | |
$item->children = get_terms( 'category', array( 'child_of' => $item->term_id, 'hide_empty' => 0 ) ); | |
if ( $item->children ) _get_child_terms( $item->children ); |
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 defaults = { | |
bar: 'no', | |
baz: 'works!' | |
}; | |
function foo( options ) { | |
Object.assign( defaults, options ); | |
console.log( defaults ); | |
} |
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
// TIMING FUNCTIONS | |
$ease: cubic-bezier(0.4, 0, 0.2, 1); | |
$ease-in: cubic-bezier(0.4, 0.0, 1, 1); | |
$ease-out: cubic-bezier(0.0, 0.0, 0.2, 1); | |
$ease-in-out: cubic-bezier(0.4, 0.0, 0.6, 1); |
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() { | |
var paged = 1, | |
isLoading = false, | |
posts = $('.posts'), | |
button = $('.read_more'), | |
foundPosts = button.attr('data-found-posts'); | |
(function() { | |
hasMoreItens() && button.fadeIn(); |
OlderNewer