Themes Flashcards
What do themes do?
Themes take the content and data stored by WordPress and display it in the browser.
What are the two files required for a theme?
The two files required for a theme are:
index.php - the main template file; and style.css - the main style file.
What is the difference between a theme and a plugin?
A theme controls the presentation of content, and it should not add critical functionality.
A plugin is used to control the behavior and features of your WordPress site.
What do the WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG PHP constants do?
WP_DEBUG is used to trigger the built-in “debug” mode on your WordPress installation.
WP_DEBUG_LOG is used in conjunction with WP_DEBUG to log all error messages to a debug.log within your WordPress /wp-content/ directory.
WP_DEBUG_DISPLAY is used to control whether debug messages display within the HTML of your theme pages.
What is the purpose of the functions.php file?
You can utilize the file to use WordPress hooks, enable WordPress features, and define functions you wish to reuse in multiple theme template files. It behaves like a WordPress plugin.
What are template files?
You use template files to affect the layout and design of different parts of your website; when someone visits a page on your website, WordPress loads a template based on the request.
What is a template partial?
A template partial is a piece of a template that is included as a part of another template; they can be embedded in multiple templates, simplifying theme creation.
What is the purpose of the **style.css* file?
The style.css file is required for every WordPress theme. It controls the presentation of the website pages.
WordPress uses the header comment section of this file to display information about the theme in the Appearance (Themes) dashboard panel.
Explain Post Types in WordPress.
Different types of content in WordPress are described as post types. Generally speaking, certain post types are tied to certain template files.
WordPress has a number of default post types, but you can use a plugin to make custom post types.
Describe the Template File Hierarchy.
Using the query string of a request, WordPress searches down through the template hierarchy until it finds a matching template file.
If WordPress cannot find a template file with a matching name, it will skip to the next file in the hierarchy. If WordPress cannot find any matching template file, the theme’s index.php file will be used.
What is the proper way to add/remove stylesheets and scripts to a theme?
Enqueue them in the functions.php file. By default, WordPress includes a number of JavaScript files as part of the software package; you can remove these files by dequeueing them in the functions.php file.
Describe categories, tags, and taxonomies.
Taxonomies are the method of classifying content and data in WordPress; categories and tags are examples.
Categories are a hierarchical taxonomy and tags are a non-hierarchical taxonomy; they are both used to classify content in the post Post Type.
You can create custom taxonomies by utilizing a plugin.
How can you call one of the default template files (header.php, footer.php, sidebar.php, etc.)?
You can call default template files with their associated template tag: get_header(), get_footer(), get_sidebar(), etc.
Explain the naming format of custom versions of default template files and how to call them.
The naming convention of a custom template file is {default-template}-{your_custom_template}.php
ex. header-top.php, footer-side.php, etc.
You can call these custom template files by calling the associated template tag and passing in the name of the custom template as the only parameter.
ex. get_header(‘top’).php, get_footer(‘side’).php, etc.
Explain how to create and call custom template files.
Use the get_template_part() method to call a custom template.