Conversation
supportHello, Is it possible to print articles from drafts? We need to export to pdf before publishing. We want to make the print version available first for some time before making it available online. Thanks.
Hi @spreaditunlimited – yes, you can use the ppn_post_query_arg filter to change the query arguments provided to WP_Query and include draft posts. That option is noted here: https://wordpress.org/plugins/printable-pdf-newspaper/#what%20filters%20and%20hooks%20are%20available%3F The filter would need to be added in your custom theme or plugin code. Here’s an example that I just tested and seems to work: /** * Include published and draft posts in Printable PDF output * @param $query_args * @return mixed */ function ppn_include_draft_posts( $query_args ) { $query_args['post_status'] = array( 'publish', 'draft' ); return $query_args; } add_filter( 'ppn_post_query_args', 'ppn_include_draft_posts' ); I hope that helps!
Thanks so much for your reply, but it doesnt seem to work, or i am putting the code in the wrong file, kindly advice which file to add the code. thanks
Unfortunately I’m not able to provide support for the details of how to add custom code to your site. These resources may be helpful: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/ https://www.skyverge.com/blog/add-custom-code-to-wordpress/
Well you have been helpful enough. It works now with the code snippet plugin
Great! Glad to hear it. If you continue enjoying the plugin, please consider leaving a review to help others learn how it has been beneficial to you.
done
Hi @spreaditunlimited – yes, you can use the ppn_post_query_arg filter to change the query arguments provided to WP_Query and include draft posts. That option is noted here: https://wordpress.org/plugins/printable-pdf-newspaper/#what%20filters%20and%20hooks%20are%20available%3F The filter would need to be added in your custom theme or plugin code. Here’s an example that I just tested and seems to work: /** * Include published and draft posts in Printable PDF output * @param $query_args * @return mixed */ function ppn_include_draft_posts( $query_args ) { $query_args['post_status'] = array( 'publish', 'draft' ); return $query_args; } add_filter( 'ppn_post_query_args', 'ppn_include_draft_posts' ); I hope that helps!
Thanks so much for your reply, but it doesnt seem to work, or i am putting the code in the wrong file, kindly advice which file to add the code. thanks
Unfortunately I’m not able to provide support for the details of how to add custom code to your site. These resources may be helpful: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/ https://www.skyverge.com/blog/add-custom-code-to-wordpress/
Well you have been helpful enough. It works now with the code snippet plugin
Great! Glad to hear it. If you continue enjoying the plugin, please consider leaving a review to help others learn how it has been beneficial to you.
done