WordPress.org

Ready to get started?Download WordPress

Forums

RV Embed PDF
[resolved] RV Embed PDF does not work on v. 3.5 (3 posts)

  1. ciaoluca@gmail.com
    Member
    Posted 1 year ago #

    Hi, I upgraded my web site and this useful plugin does not work,
    can you check the compatibility?
    Thank you!

    http://wordpress.org/extend/plugins/rv-embed-pdf/

  2. premek.v
    Member
    Plugin Author

    Posted 1 year ago #

    Hi, thanks for the report.

    Hotfix follows. I will update it in WP directory soon.

    Thanks goes also here and here:
    https://gist.github.com/2176359
    http://wordpress.stackexchange.com/questions/77212/add-filter-media-send-to-editor-does-not-work-on-wp-3-5

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <?php
    /*
    Plugin Name: RV Embed PDF
    Description: When you upload PDF and insert a link to it with the Add Media button, it will be automatically embedded in the page using Google Docs Viewer.
    Author: Rong Vang Media
    Author URI: http://www.rongvang.cz
    Version: 1.1
    */
    
    function rv_embedpdf($html, $id){
    
    	$attachment = get_post($id);
    	$mime_type = $attachment->post_mime_type;
    	$out = "";
    	if ($mime_type == 'application/pdf') {
    		$out .= '<iframe src="http://docs.google.com/gview?url='.$attachment->guid.'&embedded=true" style="width:100%; height:500px;" frameborder="0"></iframe>';
    	}
    
    	$out .= $html;
    
    	return $out;
    }
    add_filter ( 'media_send_to_editor', 'rv_embedpdf', 20, 3);
  3. ciaoluca@gmail.com
    Member
    Posted 1 year ago #

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic