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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 mattrad_remove_script_version( $src ){ | |
return remove_query_arg( 'ver', $src ); | |
} | |
add_filter( 'script_loader_src', 'mattrad_remove_script_version' ); | |
add_filter( 'style_loader_src', 'mattrad_remove_script_version' ); |
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 _e('Email us','roots'); ?>: <?php $tend_email = get_field('email_address', 'options'); ?><a href="mailto:<?php echo antispambot( $tend_email, 1 ); ?>"><?php echo antispambot( $tend_email, 0 ); ?></a> |
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
// Gravity forms UK Address. Stick it in your functions.php | |
function uk_address($address_types, $form_id) { | |
$address_types["uk"] = array( | |
"label" => "UK & Ireland", | |
"country" => "UK", | |
"zip_label" => "Postcode", | |
"state_label" => "County", | |
"states" => array("Aberdeenshire"=>"Aberdeenshire","Angus/Forfarshire"=>"Angus/Forfarshire","Argyllshire"=>"Argyllshire","Ayrshire"=>"Ayrshire","Banffshire"=>"Banffshire","Bedfordshire"=>"Bedfordshire","Berkshire"=>"Berkshire", | |
"Berwickshire"=>"Berwickshire","Blaenau Gwent"=>"Blaenau Gwent","Bridgend"=>"Bridgend","Buckinghamshire"=>"Buckinghamshire","Buteshire"=>"Buteshire","Caerphilly"=>"Caerphilly","Caithness"=>"Caithness", |
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 | |
$args = array( | |
'post_parent' => $post->ID, | |
'post_type' => 'page', | |
'orderby' => 'menu_order' | |
); | |
$child_query = new WP_Query( $args ); | |
?> |
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
// Don't use get_archives. It's deprecated. | |
<?php wp_get_archives( array( 'type' => 'postbypost', 'limit' => 5 ) ); ?> |
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 | |
$image_src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, '' ); | |
?> | |
<div class="post-thumbnail" style="background-image: url('<?php echo $image_src[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
<?php | |
// global $post; //not necessary if used in the loop | |
$parent_id = $post->post_parent; | |
if( $parent_id ) : | |
$siblings = get_pages( 'child_of=' . $parent_id . '&parent=' . $parent_id . '&exclude=' . $post->ID); | |
if( $siblings ) foreach( $siblings as $sibling ) : | |
//start of whatever you need to output// | |
echo $sibling->post_title; | |
echo get_the_post_thumbnail($sibling->ID,'medium'); | |
//end of whatever you need to 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
// Remove slug from CPT | |
// Careful of collisions and permalink must be %postname% | |
// http://www.itsabhik.com/remove-custom-post-type-slug/ | |
// There was an error in the code after $args array: , not ; | |
// See also http://colorlabsproject.com/tutorials/remove-slugs-custom-post-type-url/ | |
function remove_cpt_slug( $post_link, $post, $leavename ) { | |
$args = array( | |
'public' => true, |