Skip to content

Instantly share code, notes, and snippets.

@grex22
grex22 / gist:7553451
Created November 19, 2013 22:08
Updates to wp nav plus
function widget( $args, $instance ) {
extract($args);
if($before_widget) echo $before_widget;
$menu = wp_nav_plus(array('menu' => $instance['menu_term_id'], 'echo' => false, 'container' => false, 'items_wrap' => '%3$s', 'start_depth' => $instance['start_depth'], 'depth' => $instance['depth']));
if($instance['title']) {
if(!empty($menu)) { ?>
<h3 class="wp_nav_plus_title"><?=$instance['title'];?></h3>
<?php
}
}
@grex22
grex22 / gist:7197364
Created October 28, 2013 14:07
Data Image path for animated Loading Gif
data:image/gif;base64,R0lGODlhGAAYAPcCAO/p4RkYGAUFBLWwqisqKHp3c+rk3Ovm3u3n3+7o4enj3O7o4Ovl3ezm3uji2u3n4OXf18jDvOfh2T89PMK9t+bg2MvGvy8uLOfi2tfSy+nk3N3Y0ebh2d3X0E5NSubg2a6qpL+6tOnj2+rk3ejj29HMxdzWz9TPyOXf2OLc1aqloKmln+Pd1pmVkIyIg7m1r9bRynt4dNnUzOji215cWeXg2Ozn32xpZru2sOzm39jSy8bBuuHc1NvVzpqWkZyYk8bCu6unouTe19PNx8fCu97Y0c/Kw9vWzszGwN/Z0llWU8vGwJ+albq1r398d9DKw0pIRdLMxqOfmdrVzd7Z0aOfmoB8eNnUzcK9ttLNxraxq1xaV7y3sbm0rm5raI2Khc/Jw4eDftHLxK+qpHd0cHVybuDa02VjX7m1rnt4c8jDvZuXki4tK+rl3WRiX+fh2uHb1IiFgGBdW87Jwn56dsnEvkxKSKKdmOPe1rezrcrFvnx5ddbQyamkn8O+uL66syQiIjQyMR8dHQkJCTw7ObeyrFdUUr25srCrpbSvqcXAuW1qZ7CspoiEgG5rZ6KemdPOx1hWU6qmoODb0+Tf15eUjp+blYSBfHBuamJgXJKOiZGNiFtZVqejnYmGgdjTzIuHg4uIg62po8TAuZuYk3Fuau3o4OPd1WtpZa6po1RSUGdkYWlnY1BOTLOuqKKemJSRi42JhD07OsC7teLd1ZyYktnTzJCNiNbRycO/uE5MSoaDfoqGgg8PDj08OlNRT7izrVdVU8S/uX16dbWxqlhVU6+rpYqHgrGtprSwqkA+PBYVFCsqKWRhXnJwbDk4NktJR1JQTSooJy0sKkFAPaWhm5aSjRcWFWhmYpKPijo4N3JvayopKF5dWaGdmI+MiA4ODZOQiqGdl8G7tc3IwZ2ZlGZjYGpnZD48O1lXVGViYCwrKqainUdFQ4B9eEVDQUlHRVpYVXNxbUVEQk9NS317ds
/**
* Custom code added to P2 to enable email notifications
* when a user is @mentioned in the site.
*
* Original at http://trepmal.com/2011/06/24/using-wordpress-multisite-p2-and-more/
* and modified from there.
*/
add_action('publish_post','send_email_notification_once',9);
function send_email_notification_once($postID) {
$post = get_post($postID);
@grex22
grex22 / unusedtemplates.php
Created February 6, 2013 15:48
WordPress code for displaying all unused page templates. Great for cleaning out a bloated site with lots of old page templates!
$pages = get_posts('post_type=page&showposts=-1&post_status=any');
$tarray = array();
foreach($pages as $p){
$tarray[] = get_post_meta($p->ID, '_wp_page_template', true);
}
$used = array_unique($tarray);
$all = array();
include_once ABSPATH . 'wp-admin/includes/theme.php';
$templates = get_page_templates();
foreach ( $templates as $template_name => $template_filename ) {