Back when the blog was on Movable Type, I had rotating taglines underneath where it says “Ted’s Blog” at the top of the page. When we switched to WordPress, there was a plug-in that offered the same functionality and we installed that and I filled it with quotes. Recently the blog site was hacked and we deactivated plug-ins that were old or questionable because they might be vulnerable to hacks. Looking up some discussion on using rotating quotes, somebody suggested just adding some javscript to the the footer.php file of the theme instead of dealing with a plug-in. The correct way to do that in WordPress would be to create a child theme that I would then modify with the custom code. I had done this when we first started with WordPress and I wanted some customizations of the Twenty Eleven theme and created a child of that theme, but for the last couple of years I have been using a theme called Twenty Sixteen without a child theme. Instead Twenty Sixteen has a number of options that you can set in a control panel, including rotating header images. So I started out trying to set up a child theme of Twenty Sixteen first and wasn’t getting that to work because I needed to activate it in the Network Admin panel first. Once I did that, I just got the plain vanilla Twenty Sixteen without my custom settings. So I decided I would just modify Twenty Sixteen’s footer.php file. The danger of that is if anyone else on our blog network wanted to use Twenty Sixteen, they would get my rotating quotes, plus if there was ever a WordPress update that modified the footer.php file, which seems likely, then it would overwrite my custom file. All that means is I need a backup of the script so I can do the modification again. I am not 100% sure it would be easy to do a child theme with WordPress as it used to be, but maybe I will try it at some point.
The only tricky part was converting the quotes to something that could be stored in strings, so I had to use codes for characters like an apostrophe. I used the second code block from this page. I kept a backup of my customized quotes in a file called code.txt that is in the Twenty Sixteen child them folder I made.
I’ve never gotten the hang of a child theme, in part because I tend to want to make tiny tweaks here and there. I have started using WPcode Lite plugin (installed on Five Forks network) for things like this instead of trying to modify WP code or theme files. It allows you to insert php / javascript / css / html. Kind of like mini plugins. It’s how I insert Google Analytics tracking code, for example, instead of having a separate plugin or modifying the header template.
One advantage is you are storing these modifications in a database instead of files, and they survive theme changes.
I didn’t know about that plug-in. I moved the script from footer.php to WPcode Lite and it is working. Thanks!