WordPress – is one of the popular content management systems, that allows you to manage your online content efficiently and effortlessly. It is a open source software that anyone can download and use for their sites. Its available at WordPress.org .
A theme, is a collection of files, contained within a folder, that drive the look and feel of your website.
Each theme resides on their own folder, inside http://insert-your-website-name/wp-content/themes/.
When you install wordpress for the first time, it puts 2 themes known as “Classic” and “Default” for you to use. They are seen at http://insert-your-website-name/wp-content/themes/classic/ and http://insert-your-website-name/wp-content/themes/default/ folders respectively.
You can also upload your own themes [or themes that you download from other websites] so that it will be like http://insert-your-website-name/wp-content/themes/SomeTheme1/ and http://insert-your-website-name/wp-content/themes/SomeTheme2/ etc.
you can login into your wordpress control panel, and you would see a menu option “Presentation” and then “Themes”, that will allow you to switch between any of these themes.
How does it work?
WordPress stores the name and location of your current theme, in its database.
When someone hits the home page of your website from a browser, then WordPress uses the files in your theme folder for fulfilling the page request.
What happens when you change the current theme?
At this point, WordPress updates its database with the currently selected theme’s name and location.
For any browser requests from this point onwards, WordPress will use the files from this new theme, for building the page.
Is my content stored in the current theme folder ?
No, Your content is not stored in the theme folder. All the posts / pages and your other preferences are stored in the WordPress database. A theme knows how to get the data from the database and arranges it in a way the browser can understand and then sends it down to the browser.
So, for each request, the theme calls the database and gets the content ?
There could be some pages in your website that does not need to pull the data from the database. but the answer to that question is “Yes”, in most cases.
Ok. tell me in simple words, what “A Theme” does.
- Makes a call to the database and gets the content.
- Creates an output [most probably XHTML + CSS], that the browser can understand.
yes, thats all for now. Rest in the next part !