mnelson4 / printmyblog

WordPress Plugin that simplifies printing your entire blog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request to add custom language to pdf generated by front end print button

jaredyates1 opened this issue · comments

What a great plugin! The one thing that I wish I could do is add some custom text on the final pdf, when the pdf is generated by a user on the front end via the print button.

For example, I have added the button to the bottom of posts. When a user sees that button and presses it, the pdf is generated with the options like site url, date printed, etc. Instead of "Printed on (date)" I'd love for it to say "Printed on (date) (insert my text here)". That text is static and if I could find in the code where the "printed on" string is, I'd be happy to add it there also.

I wouldn't be opposed to this being a paid option, or sending a one-time contribution to help with its implementation.

Hi @jaredyates1, thanks for getting in touch.
Yeah that sounds like a pretty easy customization. You could directly edit the PMB code, but that will get overwritten next update (and I make updates most weeks.)
The less-upkeep way to do this is for me to add an action at the appropriate place in the code, then you'd need some code to hook into that action and print out your custom text.
I'll add that action in the next update then give you some instructions on how to use it.
I can add this freely, but a donation would be appreciated.

Sounds good to me, what's the best way to send a donation?

Hi @jaredyates1,
ok PMB 3.18.3 is ready to add your customization. Here's some code that uses the new action:

add_action('pmb_print_page_after_printed_on', 'mn_add_pmb_text');
function mn_add_pmb_text(){
    echo 'custom text appears here';
}

You'll need to add this custom code to your website (here's a tutorial on how to do that). The text "custom text appears here" will appear in the print page as you requested.

If you'd like to send a donation, please use https://www.paypal.com/paypalme/cmljnelson

Let me know if you have questions.

Spectacular, it works great! I've sent a donation, you are awesome.

Awesome and thanks! Good luck with it!
Now watch out in future updates though: I'm planning on rewriting the Quick Print and Print buttons, at which point if I overlook this action your integration might get broken and need updating. But I haven't started on that work yet so who knows, maybe it won't happen, or won't happen for many months.
Anyways, take care! Best wishes!