Themes Flashcards

1
Q

What do themes do?

A

Themes take the content and data stored by WordPress and display it in the browser.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the two files required for a theme?

A

The two files required for a theme are:
index.php - the main template file; and style.css - the main style file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the difference between a theme and a plugin?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What do the WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG PHP constants do?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the purpose of the functions.php file?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are template files?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a template partial?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of the **style.css* file?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain Post Types in WordPress.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe the Template File Hierarchy.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the proper way to add/remove stylesheets and scripts to a theme?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Describe categories, tags, and taxonomies.

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How can you call one of the default template files (header.php, footer.php, sidebar.php, etc.)?

A

You can call default template files with their associated template tag: get_header(), get_footer(), get_sidebar(), etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Explain the naming format of custom versions of default template files and how to call them.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Explain how to create and call custom template files.

A

Use the get_template_part() method to call a custom template.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What function returns the full URI to your theme’s main folder? How do you return a subfolder?

A

The get_theme_file_uri() function returns the full URI to the main folder. Pass in a subfolder to get the URI to that folder instead: get_theme_file_uri( ‘{child_folder}’)