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
/** | |
* Simple boolean helper to check if ACF is on. | |
* @return boolean | |
*/ | |
function is_acf(){ | |
return function_exists( 'get_field' ) ? true : false; | |
} | |
/** | |
* Helper function for ACF get_field function |
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 filter_acf_selection_by_ownership( $args, $field, $post ) { | |
$user = get_current_user_id(); | |
if(get_current_user_role() != 'administrator' || get_current_user_role() != 'editor'): | |
$args['author'] = $user; | |
endif; | |
return $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
<?php | |
$today = date('Ymd'); | |
$today = strtotime($today); | |
$finish = get_field('end_date'); | |
$finish = strtotime($finish); | |
$diff = $finish - $today; | |
$daysleft=floor($diff/(60*60*24)); |
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 | |
/* | |
* Loop for taxonomies to show their posts | |
*/ | |
$taxonomy = 'brand'; | |
$terms = get_terms($taxonomy); | |
foreach ($terms as $term) { | |
$wpq = array ( |
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 | |
function getAllCRMIds() { | |
global $wpdb; | |
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs} WHERE blog_id != {$wpdb->blogid} AND site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' order by blog_id", ARRAY_A); | |
// array_unshift($blogs, 1); /*Including parent blog in the array*/ | |
$crm_to_blog = array(); | |
foreach($blogs as $blog) { | |
switch_to_blog( $blog[ 'blog_id' ] ); |
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://www.advancedcustomfields.com/resources/how-to-get-values-from-a-taxonomy-term/ | |
<?php | |
// vars | |
$queried_object = get_queried_object(); | |
$taxonomy = $queried_object->taxonomy; | |
$term_id = $queried_object->term_id; | |
?> | |
<?php the_field('show_usp_strip', $queried_object); ?> |
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_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 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 unregister_default_wp_widgets() { | |
unregister_widget('WP_Widget_Pages'); | |
unregister_widget('WP_Widget_Calendar'); | |
unregister_widget('WP_Widget_Archives'); | |
unregister_widget('WP_Widget_Links'); | |
unregister_widget('WP_Widget_Meta'); | |
unregister_widget('WP_Widget_Categories'); | |
unregister_widget('WP_Widget_Recent_Comments'); | |
unregister_widget('WP_Widget_Tag_Cloud'); | |
unregister_widget('WP_Widget_RSS'); |
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 $parent_id = $post->post_parent; ?> | |
<?php the_field('custom_field', $parent_id); ?> |
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 | |
/* SLIDER CUSTOM FIELD FOR HOMEPAGE */ | |
$images = get_field('slider_photos'); | |
$count=0; | |
$count1=0; | |
if($images) : ?> | |
<div id="slider"> | |
<div id="carousel" class="carousel slide"> | |
<!-- Indicators --> |