WP Post to PDF
[resolved] WP Post to PDF and Custom Fields (5 posts)

  1. wpchef
    Posted 4 years ago #


    I'm usign your plugin and I'd like to know how to display in pdf the content of a series of custom fields (I'm using Types&Views to generate them).

    Also, is there a way to customize the informations and the content displayed in the generated pdf?

    Thank you.



  2. Neerav Dobaria
    Plugin Author

    Posted 3 years ago #

    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.

  3. Johan van der Wijk
    Posted 3 years ago #

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

  4. Sadi
    Posted 3 years ago #

    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.


  5. Jenny Beaumont
    Posted 3 years ago #

    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 ?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Post to PDF
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic