Tagged: enfold, javascript
-
AuthorPosts
-
February 2, 2016 at 12:46 pm #576392
Hi Guys,
For a client, I’ve created a specific template for her food recipes, using the “save entry as template”.
For each recipe, I’ve to add a print button to allow anyone to print the recipe.I’ve used the following code to add my action button:
<div class=”print-button”>Print the recipe </div>
I’ve add the following code in a “code block” and/or in a “text block” (using the “text” display).
My problem is that every time i want to use the recipe template, the code is removing the javascript and become this :
<div class=”print-button”>Print the recipe </div>And nobody can’t print any recipe unless I add manually my button/javascript code.
I guess the problem looks like coming from the template builder/saver.
Do you have a solution for the template saver not to remove the javascript once it’s saved?
Thanks in advance Guys,
Eldrico
February 2, 2016 at 12:59 pm #576399<div class="print-button"><a href="window.print()">Print the recipe <img src="http://madaboutmacarons.com/wp-content/uploads/2015/11/printer.png" title="Print the recipe" alt="Print the recipe" style="width:30px;height:30px;margin-left:3%;vertical-align:bottom;" /></a></div>
February 2, 2016 at 3:48 pm #576494Hey Guys,
I’ve found a way using the widget shortcode. But then I can’t anymore add a specific title (for each recipe) on the same line of the print button, it should be in two different rows.
If you have another solution, let me know.
Thanks,
Eldrico
February 4, 2016 at 5:58 am #577576Hi!
Thank you for using Enfold.
Could you please provide a screenshot of the layout that you want? The javascript code is actually missing in your post. Please post it on pastebin.com. You can save the html markup as a template and then add the javascript through a filter. Example here:
// recipe print button function add_custom_script(){ ?> <script> (function($){ //CUSTOM SCRIPT HERE })(jQuery); </script> <?php } add_action('wp_footer', 'add_custom_script');
Regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.