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
if(!Modernizr.input.placeholder){ | |
$('[placeholder]').focus(function() { | |
var input = $(this); | |
if (input.val() == input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(this); | |
if (input.val() == '' || input.val() == input.attr('placeholder')) { |
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 | |
/** | |
* Remove the "+ New" menu from the Toolbar | |
*/ | |
function remove_toolbar_new_menu() { | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu('new-content'); | |
$wp_admin_bar->remove_menu('comments'); | |
} | |
add_action('admin_bar_menu', 'remove_toolbar_new_menu', 300); |
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 | |
$slides = get_field('slider'); | |
foreach( $slides as $slide) { | |
$markup = '<img src="'. $slide['image'] .'" alt="'. $slide['alternate'] .'" >'; | |
if( $slide['link']) { | |
$markup = '<a href="'. $slide['link'] .'">' . $markup . '</a>'; | |
} | |
$markup = '<li>' . $markup . '</li>'; | |
echo $markup; | |
}; |
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 | |
function make_blank_search ($query){ | |
global $wp_query; | |
if (isset($_GET['s']) && ($_GET['s']=='' || $_GET['s']==' ') ){ | |
wp_redirect( $_SERVER['SERVER_NAME'].'/map', 301 ); exit; | |
} | |
return $query; | |
} | |
add_action('pre_get_posts','make_blank_search'); | |
?> |
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 | |
function add_grav_forms(){ | |
$role = get_role('editor'); | |
$role->add_cap('gform_full_access'); | |
} | |
add_action('admin_init','add_grav_forms'); | |
?> |
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 | |
function remove_pages_from_search() { | |
global $wp_post_types; | |
$wp_post_types['page']->exclude_from_search = true; | |
} | |
add_action('init', 'remove_pages_from_search'); | |
//via http://wordpress.stackexchange.com/questions/5453/how-do-i-remove-pages-from-search | |
?> |
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 | |
function mySearchFilter($query) { | |
if ($query->is_search) { | |
$query->set('post_type', 'post'); | |
} | |
return $query; | |
} | |
add_filter('pre_get_posts','mySearchFilter'); | |
//via http://wordpress.stackexchange.com/questions/5453/how-do-i-remove-pages-from-search |
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 | |
$term = get_the_terms( $post->ID, 'custom-taxonomy' ); | |
foreach ($term as $key) { | |
$parents = get_ancestors( $key->term_id, 'custom-taxonomy' ); | |
foreach ($parents as $parent) { | |
$key = get_term($parent, 'custom-taxonomy'); | |
$parent = $key->slug; | |
} | |
} | |
echo $parent; |
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 | |
// This returns an array of objects | |
$term = get_the_terms( $post->ID, 'custom_tax_name' ); | |
// If you need all of them, then store the things you need in a array, | |
// otherwise you can just break the loop after one iteration | |
foreach ($term as $key => $obj) { | |
$tax_name = $obj->name; | |
$tax_slug = $obj->slug; |