Editing PHP Files


#1

If I’m editing PHP files for my site, to add some site verification scripts from Google, should I install CP first, then add the code to the index page or does it matter?


#2

Presuming that you’re needing to paste the code into the header, a good bet is to get ClassicPress installed, and then add the verification code to your theme’s header file.


#3

I just migrated about 5 sites over to a new hosting provider and added CP to several new sites as well, so I need to budget several hours to spend with Google Console/Webmaster Tools/Analytics and it’s about as much fun as a root canal. I’d rather watch CSPAN for three hours. But you’re saying installing CP will over write the files?

I need to do the Google Console set ups for a roster of sites but I also need to set up the wp-contents fix in the HTACCESS file, so wondering if I should switch to CP first and then do it or if it even matters. I’d rather not have to repeat everything obviously. :disappointed_relieved:


#4

Usually you add these type of things to the header file of the theme. And usually you would not do that directly (hard-coding), but you would use either a plugin or a function, which would be added to the functions file of your child theme.

Either way ClassicPress does not touch any file in the wp-content directory to which your theme belongs, so there is nothing to worry about.


#5

Thanks for that reply, Pieter. I’m not the advanced programmer many others are on this forum but know how to add a line of code to the HTACCESS file (just press enter and paste a line of code there - easy enough). And with Google Search Console/Analytics/Tag there was some code to add to header code, but the hosting guy I spoke with said I could get around that discomfort by just uploading a HTML page to the database through the C Panel. So if switching over the ClassicPress will not change those elements, I’m “sound as a pound.”