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 | |
/** | |
* Filter the post search arguments allow for cross-post-type connections. | |
* | |
* @param array $args the WP_Query arguments used. | |
* @return array | |
*/ | |
function remote_post_search_arguments( $args ) { | |
$translated_post_types = array( 'post', 'page', 'product' ); |
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 | |
/** | |
* Check if post type supports an archive | |
* | |
* @param string $post_type post type name | |
* @uses get_post_type | |
* @global object $post | |
* @returns boolean | |
* @author Joshua David Nelson | |
*/ |
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 mattrad_remove_script_version( $src ){ | |
return remove_query_arg( 'ver', $src ); | |
} | |
add_filter( 'script_loader_src', 'mattrad_remove_script_version' ); | |
add_filter( 'style_loader_src', 'mattrad_remove_script_version' ); |
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
<img src="http://maps.google.com/maps/api/staticmap?center=<?php echo $location['lat']; ?>,<?php echo $location['lng']; ?>&markers=<?php echo $location['lat']; ?>,<?php echo $location['lng']; ?>&zoom=9&size=360x300&sensor=FALSE" /> | |
<div class="acf-map--mobile" style="background-image:url('http://maps.google.com/maps/api/staticmap?center=<?php echo $location['lat']; ?>,<?php echo $location['lng']; ?>&markers=<?php echo $location['lat']; ?>,<?php echo $location['lng']; ?>&zoom=9&size=360x300&sensor=FALSE');"></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
// Remove slug from CPT | |
// Careful of collisions and permalink must be %postname% | |
// http://www.itsabhik.com/remove-custom-post-type-slug/ | |
// There was an error in the code after $args array: , not ; | |
// See also http://colorlabsproject.com/tutorials/remove-slugs-custom-post-type-url/ | |
function remove_cpt_slug( $post_link, $post, $leavename ) { | |
$args = array( | |
'public' => 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
// Switch template based on page parent or grandparent. Requires the page parent template is set. | |
add_action('template_include', 'auto_child_template'); | |
function auto_child_template( $template = '' ) { | |
global $post; | |
if ( ! is_page() ) { | |
return $template; | |
} | |
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
function set_featured_image_from_gallery() { | |
$has_thumbnail = get_the_post_thumbnail($post->ID); | |
if ( !$has_thumbnail ) { | |
$images = get_field('gallery', false, false); | |
$image_id = $images[0]; | |
if ( $image_id ) { | |
set_post_thumbnail( $post->ID, $image_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 | |
// get taxonomy | |
$taxonomy = get_term_by( 'slug', get_query_var( 'taxonomy_name' ), 'my_custom_taxonomy' ); | |
$acf_field = get_option( 'my_custom_taxonomy_' . $taxonomy->term_id . '_acf_field_slug' ); |
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 | |
global $current_user; | |
$userID = $current_user->ID; | |
$imageArray = get_field('your_picture', 'user_' . $userID); | |
$imageThumbURL = $imageArray['sizes']['thumbnail']; | |
?> | |
<img src="<?php echo $imageThumbURL;?>"> |
NewerOlder