-
AuthorPosts
-
September 22, 2021 at 10:32 am #1321873
i use enfold for my recipe collection. can you recommend a plugin with which I can print a page like this one?
https://cookinggrannies.com/gebatener-zander-von-opa-werner-rezept-video-cooking-grannies/
That would be super helpful for the visitors to my website. A print button, so to speak. Maybe something like that will come soon for the ALB, or does it already exist? Just an icon that you can insert manually on the page which then creates a print preview. Thank you very much, Alexander
September 22, 2021 at 12:54 pm #1321907Well a print page button is easy to get – as shortcode by this snippet in child-theme functions.php:
function print_button_shortcode($atts){ return '<a class="print-page" href="javascript:window.print()">Print This Page</a>'; } add_shortcode( 'print_button', 'print_button_shortcode' );
class “print-page” is for styling that button – usage is via shortcode:
[print_button]
Styling may contain an image than a Text to showBut: there are a lot of print plugins – where you can influence the parts of your page to print ( f.e. by class )
Print-O-Matic f.e.September 22, 2021 at 2:27 pm #1321924Wow, thank you Guenni007. !!!!!
So i insert this code in the child-theme functions.php . ok, but at which position and can I add a comment so that I know again in a year what the code is good for :) Can you do that with * / or with which code?
And then i add this code: [print_button] to a code container from ALB. will an icon be displayed with which I can “print” and can I define this ivon and its size? many many thanks!
September 22, 2021 at 8:08 pm #1321951you can use the shortcode whereever you like even in widgets or text-alb element
If it is in child-theme functions.php you can have comments in one-liner by //
or in more lines by /* your text */
or like i do for my snippets – give the function a meaningfull name – i think “print_button_shortcode” is unique enough to remember what function it is.f.e.
// shortcode for print page button function print_button_shortcode($atts){ return '<a class="print-page" href="javascript:window.print()">Print This Page</a>'; } add_shortcode( 'print_button', 'print_button_shortcode' );
September 23, 2021 at 3:57 pm #1322055 -
AuthorPosts
- You must be logged in to reply to this topic.