Support » Plugin: WP Post to PDF » WP Post to PDF and Custom Fields

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


    You need to dig into code to do that, the file you should check is ‘wp-post-to-pdf.php’ in WP Post to PDF plugin directory.

    @dimitri Did you manage to display the custom field values in the PDF?

    I defined 2 filters in my theme’s functions.php

    function wp_post_to_pdf_content_prepend($content, $post_id){
        $post = get_post($post_id);
        $new_content = ....;
        // -- FOR TYPES & VIEWS
        // $new_content = types_render_field('price', array()); //get price custom field for $post
        return $new_content . $content;
    function wp_post_to_pdf_content_append($content, $post_id){
        $post = get_post($post_id);
        $new_content = ...
        return $content . $new_content;
    add_filter( 'wp_post_to_pdf_content_prepend', 'wp_post_to_pdf_content_prepend', 10, 2);
    add_filter( 'wp_post_to_pdf_content_append', 'wp_post_to_pdf_content_append', 10, 2);

    I added following code in generate_pdf_file($id, $forceDownload = false) function of wp-post-to-pdf.php file before calling of $pdf->SetCreator

    $post->post_content = apply_filters('wp_post_to_pdf_content_prepend', $post->post_content, $post->ID);
    $post->post_content = apply_filters('wp_post_to_pdf_content_append', $post->post_content, $post->ID);

    Let me know if it works for you or any better way you know.


    Am interested in this too. I’m also using Types, and although I’m able to add custom fields to wp-post-to-pdf.php, whenever I need to use the call types_render_field, my PDF is fine, but I’m no longer able to edit Posts – returns a blank screen and changes aren’t saved.

    Thoughts and/or ideas ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP Post to PDF and Custom Fields’ is closed to new replies.