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 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 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 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 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 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 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 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;?>"> |
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
// Filter wp_nav_menu() to add additional links and other output | |
function new_nav_menu_items($items) { | |
$homelink = '<li class="home"><a href="' . home_url( '/' ) . '">' . __('Home') . '</a></li>'; | |
// add the home link to the end of the menu | |
$items = $items . $homelink; | |
return $items; | |
} | |
add_filter( 'wp_nav_menu_items', 'new_nav_menu_items' ); | |
or add_filter( 'wp_nav_menu_{$menu->slug}_items', 'new_nav_menu_items' ); |
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 | |
/** | |
* Plugin Name: ACF Field to Excerpt | |
* Plugin URI: http://wordpress.stackexchange.com/q/70990/12615 | |
*/ | |
function acf_to_excerpt(){ | |
$post_type = 'post'; | |
$field = 'summary'; | |
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
<!DOCTYPE html> | |
<html lang="de"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5, minimum-scale=1" /> | |
<title>.</title> | |
<script> | |
class Confetti { | |
constructor() { | |
this.confettiConfig = { |
NewerOlder