Archived topic
What is the best way to insert code?
10 replies · Started by Ilse Turnbull on October 26, 2016
I've bought an SSL certificate for my site. I've got that uploaded ok. There is a small image that tells folks the site is secure. I have to upload code on every page I want the image to appear. I'd like some way that removing or changing it would be easy over lots of pages.
These are the two spots 2 different sets of code have to appear in
Add this before your </HEAD> tag
Add this before your </BODY> tag
Then the image itself has to be placed
Is there a way to add the image so it's universal across the site?
If I decide to change the certificate, manually changing all this over several pages would be a real chore.
What's the best way to do this?
I have a real fear for touching code - for good reason)
Hi Isle,
You can use GP hooks for this.
You'd want to insert the "before your </HEAD> tag" in the "wp_head" hook.
And the "before your </BODY> tag" in the "wp_footer" hook.
Thanks.
I put the code in each 'hook' and saved the hooks. Is that it? Do I have to place them somewhere?
That seems to have worked. It put the image in the bottom left corner, is there a way to put the image in the top right?
Can you link me to your site so I can take a peek?
ilseturnbull.com
Ugh. see this is why I don't code anymore.
I would wrap the code you inserted in the wp_footer hook with a <div> and give it a class.
Then you would use this CSS:
.your-class{
position: absolute;
top: 0;
right: 0;
}
Let me know if this works.
Thanks for all the help Stacey. I've decided to just leave it where it is for now. I was nervous about using hooks and just about anything else, but it's more familiar now. I'm going through all the tuts etc on customizing my site. Might take me awhile though.
Thank you again, I really appreciate the help
No problem :) Let me know if there is anything else I can help with!