Posts Tagged ‘podpress’

Fixing the Upload section when using Podpress

Friday, November 16th, 2007

PodPress introduces a bug whereby the Upload file browser no longer recognizes image fiiles as images, and therefore does not produce the <img> tag needed to display the image in a post.

Luckily, this can be fixed from within another WP Plugin, using the following snippet:

/*
**    Fix podpress' bug that affects WP's upload field
*/
function dsc_pp_attached_file_bug ($file, $id='') {
   if (preg_match("/upload\.php/", $_SERVER['PHP_SELF']))
      remove_filter('get_attached_file',
         'podPress_get_attached_file');
   return $file;
}
function dsc_pp_get_attachment_metadata_bug ($data, $id='') {
   if (preg_match("/upload\.php/", $_SERVER['PHP_SELF']))
      remove_filter('wp_get_attachment_metadata',
         'podPress_wp_get_attachment_metadata');
   return $data;
}
add_filter('wp_get_attachment_metadata',
   'dsc_pp_get_attachment_metadata_bug', 9, 2);
add_filter('get_attached_file',
   'dsc_pp_attached_file_bug', 9, 2);

The above code removes the filters introduced by PodPress when we’re in WP’s own Upload field.

PodPress is showing more and more annoying little features/bugs - it’s a pretty code rich plugin that does alot.

Removing the podPress footer completely

Wednesday, November 14th, 2007

Even when the ‘Show PodPress footer’ is unticked in the PodPress admin, the plugin still cranks out html code in a div with the style ‘display: none’. The following bit of code, placed in a Wordpress plugin, will remove that pesky bit of promotional code.

function p2m_remove_podpress_footer () {
        remove_action('wp_footer','podPress_wp_footer');
}
add_action('wp_footer','p2m_remove_podpress_footer', 9);

Nothing spectacular, of course. Worth noting might be that the default priority of an action is 10, so giving our removal action a priority of 9 ensures that this code runs before that of Podpress’.