- This topic has 36 replies, 2 voices, and was last updated 3 years, 10 months ago by Tom.
-
AuthorPosts
-
June 10, 2020 at 12:58 pm #1322653Michael
Hi Tom, I’m looking now at ditching the code snippets plugin as you suggested, but wanted to just check if I can literally copy and paste each one into the functions.php or if more is required?
The formatting of some of the snippets seems to be a bit different (and my knowledge of php is not good) eg
add_action( 'wp_head', function () { ?> //Code <?php } );
And then snippets like:
add_filter( 'generate_logo_output', function() { return sprintf( '<div class="site-logo"> <a href="%1$s" title="Title" rel="home"> </a> </div>', esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ) ); } );
Do I need to encapsulate all the snippets within php start and end tags (if that’s the word)? Like
<?php
then add all snippets and end with<?php
Thank you very much for your help.
Michael.
June 10, 2020 at 3:46 pm #1322789TomLead DeveloperLead DeveloperYou can just move those over as they are.
Your
functions.php
file will start with a<?php
tag, and it never needs to be closed (?>
).June 11, 2020 at 6:30 am #1323536MichaelAwesome Tom, thank you very much
June 11, 2020 at 9:48 am #1323947TomLead DeveloperLead DeveloperYou’re welcome 🙂
June 11, 2020 at 10:13 am #1323983MichaelHi Tom,
Please can I ask if there is a snippet to achieve this?
https://www.dropbox.com/s/76rh2s1jwdak48a/content-best-practice-score.jpg?dl=0
These are the links on the featured images on my blog page.
Thank you for your help!
Michael.
June 11, 2020 at 11:16 am #1324050MichaelAnd I’m attempting to add webp images to the footer but for some reason customizer is stripping the the additional html:
<div class="featured-in"> <p>As Featured In:</p> <picture> <source srcset="https://reclaimdesign.org/wp-content/uploads/as-featured-in-trim.webp" type="image/webp"> <source srcset="https://reclaimdesign.org/wp-content/uploads/as-featured-in-trim.jpg" type="image/jpeg"> <img src="https://reclaimdesign.org/wp-content/uploads/as-featured-in-trim.jpg" alt="Publications we have been featured in | Reclaim Design" title="Reclaim Design As Featured In: Condé Nast | SA Garden & Home | House & Leisure | SA Homeowner | Elle Decor | Home | VISI" width="960" height="55" /> </picture> </div>
After saving in customizer becomes:
https://www.dropbox.com/s/0qf9r5hf4m1k9t1/customizer-stripping-picture-webp.jpg?dl=0
Thank you for your help!
June 11, 2020 at 4:22 pm #1324334TomLead DeveloperLead DeveloperAny chance you can open a new topic as this one is resolved?
Thanks! 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.