This file contains hidden or 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
// Place this in wp-config | |
define( 'ACF_5_KEY', 'yourkeyhere' ); | |
// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent. | |
function auto_set_license_keys() { | |
if ( ! get_option( 'acf_pro_license' ) && defined( 'ACF_5_KEY' ) ) { | |
$save = array( | |
'key' => ACF_5_KEY, |
This file contains hidden or 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 class of "hub-$template_colour" to a page and its descendants | |
// Adapted from http://techtabby.com/how-to-add-body-class-to-page-and-descendants-wordpress/ | |
function tend_parent_body_class( $classes ) { | |
if( is_page() ) { | |
$parents = get_post_ancestors( get_the_ID() ); | |
$id = ($parents) ? $parents[count($parents)-1]: get_the_ID(); | |
if ($id) { | |
if(get_field('colour_picker', $id )) { | |
$template_colour = get_field('colour_picker', $id); | |
$classes[] = 'hub-' . $template_colour; |
This file contains hidden or 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('website_logo','options')) { | |
$Array = get_field('website_logo','options'); | |
$URL = $Array['url']; | |
$height = ($Array['height'])/2; | |
$width = ($Array['width'])/2; | |
echo '<a class="logo" href="'.esc_url(home_url('/')).'" style="background-image:url('.$URL.'); width:'.$width.'px; height:'.$height.'px;">'.get_bloginfo('name').'</a>'; | |
} else { |
This file contains hidden or 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 | |
$repeater = get_field( 'testimonial','options' ); | |
$rand = rand(0, (count($repeater) - 1)); | |
echo '<blockquote><p>'.$repeater[$rand]['quote'].'</p>'; | |
if (!empty($repeater[$rand]['citation'])) { echo '<cite>'.$repeater[$rand]['citation'].'</cite>';}; | |
echo '</blockquote>'; | |
?> |
This file contains hidden or 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="testimonials__content"> | |
<?php | |
$repeater = get_field( 'testimonial','options' ); | |
$rand = rand(0, (count($repeater) - 1)); | |
echo $repeater[$rand]['quote']; | |
echo $repeater[$rand]['citation']; | |
?> | |
</div> |
This file contains hidden or 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( have_rows('billboard') ): ?> | |
<div class="billboard"> | |
<?php while( have_rows('billboard') ): the_row(); | |
$imageArray = get_sub_field('image'); | |
$imageURL = $imageArray['url']; | |
?> | |
<div class="slide-item" style="background-image: url('<?php echo $imageURL;?>');" > | |
<h1><?php the_sub_field('title'); ?></h1> | |
</div> |
This file contains hidden or 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('wp_footer', 'add_googleanalytics'); | |
function add_googleanalytics() { ?> | |
<script> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); |
This file contains hidden or 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_action('wp_head', 'print_emoji_detection_script', 7); | |
remove_action('wp_print_styles', 'print_emoji_styles'); | |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
remove_action( 'admin_print_styles', 'print_emoji_styles' ); |
This file contains hidden or 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
if(get_field('variations')) : | |
$product_variations = get_field('variations'); | |
$product_variations_count = count( get_field( 'variations' ) ); | |
echo $product_variations_count; | |
if($product_variations_count > 1) : |
This file contains hidden or 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 set_featured_image_from_gallery() { | |
global $post; | |
$post_id = $post->ID; | |
$has_thumbnail = get_the_post_thumbnail($post_id); | |
if ( !$has_thumbnail ) { | |
$images = get_field('image_gallery', $post_id, false); |