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
//Replace og:image with either the post featured image, or an image of the speaker | |
//Requires Yoast | |
add_action( 'wpseo_opengraph', 'replace_og_image', 30 ); | |
function replace_og_image() { | |
global $post; | |
$featured_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); | |
$speaker = get_field('speaker', $post->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
function retrieve_the_content( $var1 ) { | |
global $post; | |
return strip_tags($post->post_content); | |
} | |
function yoast_custom_meta_variables() { | |
wpseo_register_var_replacement( '%%the_content%%', 'retrieve_the_content', 'basic', 'Replaced with The Content' ); | |
} | |
add_action( 'wpseo_register_extra_replacements', 'yoast_custom_meta_variables' ); |
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
add_action( 'init', 'check_for_content', 30 ); | |
function check_for_content( $post_id ) { | |
$args = array( | |
'posts_per_page' => -1, | |
'offset' => 0, | |
'category' => '', | |
'category_name' => '', | |
'orderby' => 'date', | |
'order' => 'DESC', |
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 change_acf_meta_keys() { | |
global $wpdb; | |
$values = array( | |
"0" => array( | |
'old_value' => 'foo1', | |
'new_value' => 'bar1', | |
), | |
"1" => 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
//Load GA Plugin. If unable to load, wait 50 milliseconds and attempt load again. | |
function providePlugin(pluginName, pluginConstructor) { | |
if (window.ga && document.body ) { | |
ga('provide', pluginName, pluginConstructor); | |
} | |
else { | |
window.setTimeout(function() { | |
providePlugin('main_analytics', gaEventsLoader); | |
}, | |
50); |
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
//By buddel - http://php.net/manual/en/function.array-search.php#usernotes | |
function recursive_array_search($needle,$haystack) { | |
foreach($haystack as $key=>$value) { | |
$current_key=$key; | |
if($needle===$value OR (is_array($value) && recursive_array_search($needle,$value) !== false)) { | |
return true; | |
} | |
} | |
return false; |
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
//woocommerce gallery - main header | |
$('.woocommerce-main-image').click(function() { | |
var $main_image = $('a.woocommerce-main-image').attr('href'); | |
var $items = new Array(); | |
var link = $('a.woocommerce-main-image').attr('href'); | |
var alt = $('a.woocommerce-main-image').find('img').attr('alt'); | |
var mainitem = { src: link, title: alt }; | |
$items.push(mainitem); |
NewerOlder