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_filter('woocommerce_email_order_meta_fields', 'dog_breed_checkout_field_order_meta_fields', 10, 3 ); | |
function dog_breed_checkout_field_order_meta_fields( $fields, $sent_to_admin, $order ) { | |
$fields['dog_breed_name'] = array( | |
'label' => __( 'Dog Breed' ), | |
'value' => get_post_meta( $order->id, 'dog_breed_name', true ), | |
); | |
return $fields; | |
} |
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 customize_cpt_archive_query( $query ) { | |
if ( is_post_type_archive( 'gemstone' ) ) { | |
$query->set( 'posts_per_page', -1 ); | |
$query->set( 'orderby', 'title' ); | |
$query->set( 'order', 'ASC' ); | |
return; | |
} | |
} | |
add_action( 'pre_get_posts', 'customize_cpt_archive_query', 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
add_action( 'genesis_before', 'craigsimps_browsehappy' ); | |
/** | |
* Show the browsehappy link | |
* if browser is less than IE8 | |
*/ | |
function craigsimps_browsehappy() { | |
?> | |
<!--[if lt IE 8]> | |
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> | |
<![endif]--> |
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
.browserupgrade { | |
background: #ccc; | |
color: #000; | |
padding: 10px 0; | |
text-align: center; | |
} |
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 the existing loading of html5shiv | |
remove_action( 'wp_head', 'genesis_html5_ie_fix' ); | |
add_action( 'wp_enqueue_scripts', 'craigsimps_enqueue_modernizr' ); | |
/** | |
* Load the modernizr library, with built in html5shiv for users of IE8 or below. | |
*/ | |
function craigsimps_enqueue_modernizr() { | |
global $wp_scripts; | |
wp_enqueue_script( 'craigsimps-modernizr', get_stylesheet_directory_uri() . '/assets/js/modernizr.min.js', array('jquery'), '2.8.3', true ); |
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 | |
function return_escaped_acf_wysiwyg( $field, $post_id = false ) { | |
// if there's no post id defined, get id from current post. | |
if( !$post_id ) { | |
$post_id = (int) get_the_ID(); | |
} | |
// get the kses'd content |
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 | |
//Insert ads after second paragraph of single post content. | |
add_filter( 'the_content', 'prefix_insert_post_ads' ); | |
function prefix_insert_post_ads( $content ) { | |
$ad_code = '<div>Ads code goes here</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 | |
add_filter( 'genesis_search_form', 'prefix_unhide_search_label' ); | |
function prefix_unhide_search_label( $markup ) { | |
return str_replace( ' screen-reader-text', '', $markup ); | |
} |
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 | |
function return_array_of_objects_from_acf_ids( $field_name ) { | |
$post_ids = get_post_meta( get_the_ID(), $field_name, true ); | |
foreach ( $post_ids as $post_id ) { | |
$objects[] = get_post( $post_id ); | |
} |
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 | |
function get_acf_meta( $post_id, array $meta_keys ) { | |
foreach ( $meta_keys as $meta_key ) { | |
$fields[$meta_key] = get_post_meta( $post_id, $meta_key, true ); | |
} | |
return $fields; |