I finally got around to actually making my website look somewhat nicer instead of just picking a an admittedly bad theme and sticking with it. Part of the reason it took me so long was my front end web development skills were a little rusty. I could barely remember all the necessary tags to put together a working HTML file let alone dynamically generate web pages in PHP. Now that the FE is out of the way, my GRE is a ways off, and I’m not back in class yet I have quite a bit of free time after work to pursue this project. My goal was to familiarize myself with some front-end web page development and generate my own WordPress theme to add some more personalized flair to my website.
I didn’t know it at first, but WordPress was a great medium to practice these skills given that it’s both the largest open source PHP project and it was built with easy customization in mind. I had not delved too much into the PHP plumbing that makes WordPress what it is let alone read the documentation or even explore all the settings pages. What I quickly learned was the brilliant way each WordPress page was generated from separate PHP files. I’m not a web developer so this is really my first look at the architecture of a modern website, and I’m actually pretty amazed by it and how similar it is to application programming. A WordPress page is essentially generated by script that calls a function that generates the header portion, then in a loop querying the content database it calls another routine to generate the posts, and finally another function ends it to generate a footer. There’s more to it then that, but that’s the basic idea.
What really blew my mind when I started thinking about it is that the modern webpage is built on a number of different programming languages/tools that have coevolved and work together seamlessly. It’s not something you run into very often in my line of work, I would never inject Python into C Code. Nor will I use a separate language to define my variables, but stuff like this happens all over in the world wide web. Having PHP scripts generate an HTML file to be parsed by a browser and a CSS file that defines the attributes of each tag kind of astounds me.
As for my theme, at the time of this writing you’ll notice that the page still very much resembles the official WordPress 2013 theme. This is because I decided to take the child theme approach which takes many pages from the book of object oriented programming. I was able to inherit the stable code base and look of the parent theme, while using polymorphism to make my tweaks. When creating a child theme you have the ability to either make changes to the appearance using the CSS file or implement new functionality by changing the PHP files.
CSS I’ve learned is a very neat way of maintaining the look of a certain website. It’s basically a way to make site wide changes to specific tags in an HTML file. These can be fonts, colors, boundaries, alignments, and a whole bunch of other neat tricks. The cascading part comes into play when you start having nested tags. When you write a CSS file, you want to define a set of default values for all the major HTML tags that will be a fall back on. From there you can subdivide the different tags on your website and redefine their attributes to meet your needs. I’ve mostly been playing around with margins, paddings, and fonts. I want to get the basic shape of the site down before I start tweaking other aesthetics like colors and graphics.
The other trick is modifying the PHP. This is a little more advanced and I haven’t played around with it too much. I made one small change to the footer of this site to display my name, but that’s it for now. The trouble with modifying PHP is you have to really know which PHP file does what and have a goal in mind for what you want to accomplish. Without a goal in mind there’s really no point in pursuing a PHP modification because most if not all the tweaks you’d want to do can be found in the WordPress dash. Funny thing about that is, I never took the time to find out how easy it was to just use the WordPress dash to change and add things to the page. Most people could probably get away with never mucking around in the code honestly.