Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author ntm

    (@ntm)

    The podPress HTML element in the blog posts have class names according to the embedded media file e.g. podPress_content_audio_mp3.

    Or you could use podPress Filter hooks and parse the output of podPress for these class names.
    possible filter hooks are:

    • podpress_downloadlinks (for the element below the player)
    • podpress_post_scriptblock (the JS which is necessary to initialize the player)
    • podpress_post_content (the complete podPress output per post)

    A further possibility is to make an own db query. You would need to know the ID of the current post. With the post ID, you could look in the wp_postmeta table whether the post has meta data with the meta_key _podPressMedia. The content of these db entries is a serialized array. These strings/arrays contains the mime type in form of a string which starts with audio_ if it is an entry for an audio attachment.

    Thread Starter MCM

    (@nathmie)

    Can you provide me with some help with this? I have tried googling to find a way to check for values inside the_content.

    I have looked at the codex pages around post_class.

    Am I on the right track?

    add_filter( 'the_content', 'podcast_get_media_type' );
    function podcast_get_media_type() {
    
    	$htmlString = '<html>...</html>';//either generated, or loaded from a file
    	$dom = new DOMDocument;
    	$dom->loadHTML($htmlString);//or loadHTMLFile
    	$divs = $dom->getElementsByTagName('div');
    	foreach($divs as $div)
    	{
    		if ($div->hasAttribute('class') && strstr($div->getAttribute('class'), 'podPress_content podPress_content_audio_mp3'))
    		{
    			echo 'has mp3 file';
    		}
    		echo $divs;
    	}
    
    }
    Thread Starter MCM

    (@nathmie)

    This works but it is displaying the echo twice, any ideas?

    add_filter( 'podpress_post_content', 'podcast_get_media_type' );
    function podcast_get_media_type($content) {
    
    	 if(strpos($content, 'podPress_content podPress_content_audio_mp3'))
    	 {
            echo 'Stream or Download this Audio or subscribe to our Podcasts for this Speaker (if available)';
        } else {
            echo 'it does NOT work';
        }
    
    	return $content;
    
    }
    Thread Starter MCM

    (@nathmie)

    removed the echo’s 🙂 Thanks for your initial feedback apologies for the updates at least others know how to get this done.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Media Format Code checker or something?’ is closed to new replies.