Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I defined 2 filters in my theme’s functions.php

    //PDF - GENERATION FILTERS
    
    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.

    Thanks

    Sadi

    (@geniussadi)

    Don’t activate the plugin until you change the plugin folder name to ‘wp_export’ (from wp-export-all-post-information-excel-format).

    Thanks,
    Sadi

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