Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Anthony Martin

    (@spidlace)

    Hi David,

    Thanks for your response.

    There is indeed a hook in the standard function wp_get_attachment_image(), but all my pdf don’t go in this hook because in the function wp_get_attachment_image, they don’t have image src..

    But, I hook into function wp_get_attachment_image_src() and I get the good result !
    This is how I make, if someone is interested :

    if(!function_exists('sp_change_icon_pdf_media')){
        function sp_change_icon_pdf_media($image, $attachment_id, $size, $icon){
    
            global $pagenow;
    
            if(!is_admin() && $pagenow != 'upload.php')  return $image;
            
            $mime_type = get_post_mime_type($attachment_id);
            if($mime_type == 'application/pdf'){
                // Do stuff
                $url = 'https://www.domain.com/test.jpg';
            } else $url = '';
            
            return array($url, 64, 64, $icon);
        }
        add_filter('wp_get_attachment_image_src', 'sp_change_icon_pdf_media', 10, 4);
    }

    Thanks again David,
    Anthony

    Thread Starter Anthony Martin

    (@spidlace)

    Hi David,

    Thanks for the copy.
    I test it, and you do a great job for this news hooks !!

    But I have one question.
    It is possible to remove textarea for metabox ? Because, when I want to add some HTML and CSS in this text, I can’t and my tag are visible and not understand by the browser…
    Do you see what I mean ?

    (this is a screenshot for understand my problem)

    https://img4.hostingpics.net/pics/842232mla.png

    Thread Starter Anthony Martin

    (@spidlace)

    Hi David,

    Thanks for your answer and your development.

    I send you a email and I’m a hurry to test the new version of this plugin ! ??

    Thanks you very much

    Thread Starter Anthony Martin

    (@spidlace)

    Very nice ! I wait this update with impatience.

    Thanks you

Viewing 4 replies - 1 through 4 (of 4 total)