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
// ACF field added to body class | |
// Adapted from http://krogsgard.com/2012/wordpress-body-class-post-meta/ | |
add_filter('body_class','tend_custom_field_body_class'); | |
function tend_custom_field_body_class( $classes ) { | |
global $wp_query; | |
$postid = $wp_query->post->ID; | |
if ( is_page_template('template-service-index.php') ) { |
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, |
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 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
/* Limit Your Website Excerpt */ | |
function word_limit($string, $max_words){ | |
$post_words = explode(' ', $string); | |
$count = count($post_words); | |
$post_words = implode(' ', array_slice($post_words, 0, $max_words)); |
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
wp_trim_words( $text, 55, ‘…’ ); |
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
<div class="flexslider-home"> | |
<ul class="slides"> | |
<?php while( have_rows('image_slider') ): the_row(); | |
$imageArray = get_sub_field('image'); | |
$imageURL = $imageArray['sizes']['large']; | |
$imageThumb = $imageArray['sizes']['thumbnail']; | |
$imageCap = $imageArray['caption']; | |
?> | |
<li style="background-image: url('<?php echo $imageURL;?>');" data-thumb="<?php echo $imageThumb;?>"> | |
<?php if($imageCap) : ?> |
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 if(get_field('current_donations_total','options')) : | |
echo '£' . number_format((get_field('current_donations_total','options')), 0, '.', ','); | |
endif; ?> |
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
// Shows single image for all "flexslider-" sliders if JS is not enabled | |
.no-js { | |
[class^="flexslider"] { | |
li { | |
&:not(:first-child) { | |
display: none; | |
} | |
} | |
} | |
} |
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
<script> | |
// Email current page with title | |
function emailCurrentPage(){ | |
window.location.href="mailto:?subject="+document.title+"&body="+escape(window.location.href); | |
} | |
</script> | |
<a class="icon-mail" href="javascript:emailCurrentPage()"><span class="sr-only"><?php _e('Share via email','roots'); ?></a> |