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
// Hierarchaly ordered array of terms | |
function sort_terms_hierarchicaly( Array &$cats, Array &$into, $parentId = 0 ) { | |
foreach ( $cats as $i => $cat ) { | |
if ( $cat->parent == $parentId ) { | |
$into[$cat->term_id] = $cat; | |
unset( $cats[$i] ); | |
} | |
} | |
foreach ( $into as $topCat ) { |
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
// ================ | |
// G R A D I E N T | |
// M I X I N | |
// ================ | |
// from http://codepen.io/Hornebom/pen/epqmGx/ | |
// Built upon the logic found in a ps file | |
// element has a solid background | |
// background is covered by a gradient of one color | |
// one can define the opacity of the two color stops + the gradient angle |
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
// Alterando o texto da blank line do Contact form 7 | |
function my_wpcf7_form_elements($html) { | |
$text = 'Selecione o departamento'; | |
$html = str_replace('<option value="">---</option>', '<option value="">' . $text . '</option>', $html); | |
return $html; | |
} | |
add_filter('wpcf7_form_elements', 'my_wpcf7_form_elements'); |
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
.video{ | |
width: 100%; | |
position: relative; | |
padding-bottom: 56.25%; | |
padding-top: 30px; | |
height: 0; | |
overflow: hidden; | |
margin-bottom: 15px; | |
} |
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_filter('oembed_result', 'custom_oembed_result', 10, 3); | |
function custom_oembed_result($html, $url, $args) { | |
if ($args) { | |
$newargs = $args; | |
$parameters = http_build_query($newargs); | |
$html = preg_replace('/(player.vimeo.com\/video\/[0-9]*)/i', '$1?' . $parameters, $html); | |
} | |
return $html; | |
} |
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
// remove unncessary header info | |
function frq_remove_header_info() { | |
remove_action('wp_head', 'rsd_link'); | |
remove_action('wp_head', 'wlwmanifest_link'); | |
remove_action('wp_head', 'wp_generator'); | |
remove_action('wp_head', 'start_post_rel_link'); | |
remove_action('wp_head', 'index_rel_link'); | |
remove_action('wp_head', 'adjacent_posts_rel_link'); | |
} | |
add_action('init', 'frq_remove_header_info'); |
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
// get excerpt by id | |
function mg_get_the_excerpt($post_id) { | |
global $post; | |
$save_post = $post; | |
$post = get_post($post_id); | |
$output = get_the_excerpt(); | |
$post = $save_post; | |
return $output; | |
} |
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
// Excerpt length | |
function custom_excerpt_length( $length ) { | |
return 20; | |
} | |
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); |
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
try{ | |
$('.backtop').click( function(e){ | |
e.preventDefault(); | |
$('html,body').animate({ | |
scrollTop: '0px' | |
}, 800 ); | |
}) | |
} catch(e){ | |
console.log(e); | |
} |