Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter Lee Kung

    (@grmark)

    sorry, the second point is already correct
    here is what I do to get correct pdf_id

    //in post loop
    $image_id = get_post_meta( $post->ID, '_thumbnail_id', true );
    if($image_id) {
        $image = get_post($image_id);
        if($image && $image->post_parent > 0) {
            $pdf = get_post($image->post_parent);
            if($pdf && $pdf->post_mime_type == 'application/pdf') {
                $pdf_url = wp_get_attachment_url($pdf->ID);
            }
        }
    }
Viewing 1 replies (of 1 total)