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 (function_exists('get_field')) { | |
$fields = get_fields(); | |
if( $fields ) { | |
foreach( $fields as $field_name => $value ) { | |
$field = get_field_object($field_name, false, array('load_value' => false)); | |
if($value) { |
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
// helper function for twitter card stuff | |
// GET YOUTUBE ID FROM URL | |
function getYouTubeIdFromURL($url) { | |
$pattern = '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i'; | |
preg_match($pattern, $url, $matches); | |
return isset($matches[1]) ? $matches[1] : false; | |
} |
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
// GET YOUTUBE ID FROM URL | |
function getYouTubeIdFromURL($url) { | |
$pattern = '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i'; | |
preg_match($pattern, $url, $matches); | |
return isset($matches[1]) ? $matches[1] : false; | |
} |
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
// change # to the id of your form to target a specific form | |
add_filter( 'gform_notification_#', 'route_notification', 1, 2 ); | |
function route_notification($notification, $form , $entry) { | |
global $post; | |
// the $post here is the post where the Form is displayed | |
$email_to = get_post_meta($post->ID, 'email', true); | |
if ($email_to){ | |
$notification['to'] .= ',' . $email_to; | |
} | |
return $notification; |
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('book_features', $acfw)) { | |
$features = get_field('book_features', $acfw); | |
$count = count($features); | |
echo '<div class="widget-features count-' . $count . ' cf">'; | |
while ( have_rows('book_features', $acfw) ) { the_row(); | |
$headline = get_sub_field('headline', $acfw); | |
$sub_head = get_sub_field('sub_head', $acfw); | |
$cta = get_sub_field('cta_text', $acfw); | |
$feature_link = ''; |
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
jQuery(document).ready(function($) { | |
$.getScript('//www.youtube.com/iframe_api'); | |
var cnt = 0; | |
$('.flexslider iframe[src*=youtube]').each(function() { | |
$(this).attr('id', 'youtubeplayer' + cnt); | |
cnt++; | |
}); | |
loadSlider(); |
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
// DISPLAY SIMPLE SECTION NAVIGATION VIA SHORTCODE | |
// adapted from the fantastic Simple Section Navigation plugin which is alas no longer being maintained | |
// http://wordpress.org/plugins/simple-section-navigation/ | |
add_shortcode('simplesidenav', 'mm_simplesidenav'); | |
function mm_simplesidenav( $atts, $content = null) { | |
extract( shortcode_atts( array( | |
'exclude' => '', | |
'topic' => '', | |
//'hierarchical' => 'false', | |
), $atts ) ); |
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 USING CUSTOM PERMALINKS LIKE CATEGORY/POSTNAME, PAGE NAVIGATION BREAKS ON PAGE 2. THIS IS THE FIX | |
// from http://barefootdevelopment.blogspot.com/2007/11/fix-for-wordpress-paging-problem.html | |
add_filter('request', 'remove_page_from_query_string'); | |
function remove_page_from_query_string($query_string) { | |
if ($query_string['name'] == 'page' && isset($query_string['page'])) { | |
unset($query_string['name']); | |
// 'page' in the query_string looks like '/2', so split it out | |
list($delim, $page_index) = split('/', $query_string['page']); | |
$query_string['paged'] = $page_index; | |
} |
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
// HIDE MASTER ADMIN ACCOUNT SO IT CAN'T BE ACCIDENTALLY DELETED | |
add_action('pre_user_query','yoursite_pre_user_query'); | |
function yoursite_pre_user_query($user_search) { | |
global $current_user; | |
$username = $current_user->user_login; | |
if ($username !== 'MASTER_ADMIN_USERNAME_HERE') { | |
global $wpdb; | |
$user_search->query_where = str_replace('WHERE 1=1', | |
"WHERE 1=1 AND {$wpdb->users}.user_login != 'MASTER_ADMIN_USERNAME_HERE'",$user_search->query_where); |
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
/* | |
* See http://wordpress.stackexchange.com/a/28784/16 for all options | |
*/ | |
add_action( 'admin_menu', 'my_remove_menu_pages', 9999 ); | |
function my_remove_menu_pages() { | |
global $current_user; | |
$username = $current_user->user_login; | |
if ($username !== 'SPECIFIC-ADMIN-USERNAME-HERE') { | |
remove_menu_page('edit-comments.php'); |