Skip to content

Instantly share code, notes, and snippets.

View iagdotme's full-sized avatar

Ian Anderson Gray iagdotme

View GitHub Profile
@iagdotme
iagdotme / disable-admin-bar.php
Last active December 22, 2015 05:08
Disable WP Admin Bar
<?php
/* Disable the Admin Bar. */
// From: http://yoast.com/disable-wp-admin-bar/
add_filter( 'show_admin_bar', '__return_false' );
function sp_hide_admin_bar_settings()
{
?><style type="text/css">.show-admin-bar {display: none;}</style><?php
}
@iagdotme
iagdotme / strip.php
Created September 24, 2015 16:28
Strips out junk HTML from WP posts once imported from Blogger
$args = array( 'numberposts' => '150' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
$post = get_post($recent["ID"]);
$content = apply_filters('the_content', $post->post_content);
$content = strip_tags($content,"<p><br><a><img><ul><li>");
$content = str_replace('style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"',"",$content);
$content = str_replace('style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"',"",$content);
$content = str_replace('border="0"',"",$content);