WordPress Theme Development Flashcards

(25 cards)

1
Q

What is a WordPress theme?

A

A WordPress theme is a collection of PHP, CSS, and JavaScript files that control a site’s design and layout.

Themes define the visual appearance and structure of a WordPress site, including templates (e.g., index.php) and styles (style.css). Freelancers create or customize themes to meet client branding needs, while enterprise architects use themes to ensure consistent, scalable designs across large-scale deployments.

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

What is the minimum requirement for a WordPress theme?

A

A theme requires a style.css file with a header comment and an index.php file.

The style.css file must include metadata (e.g., Theme Name, Author) in its header, and index.php serves as the default template. Freelancers start with these to build custom themes, while enterprise architects ensure minimal, optimized setups for performance.

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

What is the purpose of style.css in a theme?

A

style.css defines the theme’s styles and includes metadata to identify the theme.

The file starts with a comment block (e.g., /* Theme Name: My Theme */) that WordPress reads to display the theme in the admin panel. Freelancers use it for styling, while enterprise architects optimize it for cross-browser compatibility and performance.

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

What is index.php in a WordPress theme?

A

index.php is the default template file used to render content when no specific template applies.

It’s the fallback template in the WordPress template hierarchy, often containing the Loop to display posts. Freelancers customize it for blog or homepage layouts, while enterprise architects ensure it’s lightweight for scalability.

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

What is the WordPress template hierarchy?

A

The template hierarchy determines which PHP template file WordPress uses to display a page.

Files like single.php, page.php, or category.php are chosen based on content type or URL. Freelancers design templates within this hierarchy for client-specific layouts, while enterprise architects use it for structured, scalable page rendering.

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

What is single.php used for?

A

single.php displays a single post or custom post type.

This template handles individual post views, using the Loop to output content like the title and body. Freelancers customize it for unique post layouts, while enterprise architects optimize it for dynamic content delivery in large systems.

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

What is page.php used for?

A

page.php displays static WordPress pages, like “About” or “Contact.”

It’s used for non-time-based content, distinct from posts. Freelancers create custom page templates for clients, while enterprise architects ensure page.php supports modular, reusable designs for enterprise sites.

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

What is a custom page template?

A

A custom page template is a PHP file with a specific header comment for unique page layouts.

Defined with <?php /* Template Name: My Template */ ?>, it lets users select the template in the page editor. Freelancers use it for client-specific pages (e.g., landing pages), while enterprise architects create templates for consistent layouts across sites.

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

What is header.php?

A

header.php contains the HTML <head> section and top-level markup, like navigation.

Included via get_header(), it typically includes meta tags, CSS, and menus. Freelancers customize it for branding, while enterprise architects optimize it for performance and SEO in large deployments.

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

What is footer.php?

A

footer.php contains the closing HTML markup and footer content, like widgets or scripts.

Included via get_footer(), it triggers the wp_footer hook for scripts. Freelancers add client-specific footer elements, while enterprise architects ensure efficient script loading for scalability.

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

What is sidebar.php?

A

sidebar.php defines a widgetized area for dynamic content, like menus or recent posts.

Included via get_sidebar(), it displays widgets set in Appearance > Widgets. Freelancers customize sidebars for client needs, while enterprise architects use them for modular, reusable UI components.

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

What is functions.php in a theme?

A

functions.php is a PHP file for adding custom code, like hooks or theme settings.

It’s used to enqueue scripts, register menus, or add custom functions. Freelancers use it for client-specific features, while enterprise architects ensure its code is secure and optimized for large systems.

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

What does wp_enqueue_style() do in a theme?

A

wp_enqueue_style() loads CSS files with proper dependency management.

For example, wp_enqueue_style(‘my-style’, get_stylesheet_uri()) loads style.css. Freelancers use it to add custom styles, while enterprise architects optimize it for performance and dependency handling.

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

What does wp_enqueue_script() do in a theme?

A

wp_enqueue_script() loads JavaScript files with dependency control.

For example, wp_enqueue_script(‘my-script’, get_template_directory_uri() . ‘/js/script.js’, array(‘jquery’)) loads a script. Freelancers add interactivity, while enterprise architects ensure efficient, scalable script loading.

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

What is get_template_directory_uri()?

A

get_template_directory_uri() returns the URL of the active theme’s directory.

Used in enqueuing assets (e.g., get_template_directory_uri() . ‘/css/style.css’), it ensures correct file paths. Freelancers use it for theme assets, while enterprise architects rely on it for consistent resource linking.

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

What is get_stylesheet_uri()?

A

get_stylesheet_uri() returns the URL of the theme’s style.css file.

It’s used in wp_enqueue_style() to load the main stylesheet. Freelancers use it for styling, while enterprise architects ensure it points to optimized, minified CSS for performance.

17
Q

What is a child theme?

A

A child theme inherits a parent theme’s functionality while allowing customizations.

It requires a style.css with a Template header and a functions.php file. Freelancers use child themes to modify premium themes, while enterprise architects use them to maintain upgradability in large deployments.

18
Q

How do you create a child theme?

A

Create a folder with style.css (including Template: parent-theme) and optionally functions.php.

The style.css header specifies the parent theme (e.g., Template: twentytwenty). Freelancers use child themes for safe customizations, while enterprise architects ensure they’re lightweight and maintainable.

19
Q

What is wp_nav_menu()?

A

wp_nav_menu() displays a navigation menu defined in Appearance > Menus.

For example, wp_nav_menu(array(‘theme_location’ => ‘primary’)) outputs a menu. Freelancers customize menus for clients, while enterprise architects ensure menus are dynamic and scalable.

20
Q

What is register_nav_menus()?

A

register_nav_menus() registers locations for navigation menus in a theme.

For example, register_nav_menus(array(‘primary’ => ‘Primary Menu’)) adds a menu location. Freelancers set up menus for client sites, while enterprise architects use them for flexible navigation structures.

21
Q

What is the WordPress Loop in theme development?

A

The Loop is PHP code that retrieves and displays posts in theme templates.

Using have_posts() and the_post(), it outputs content like titles and excerpts. Freelancers customize Loops for blog layouts, while enterprise architects optimize them for performance in large sites.

22
Q

What is get_template_part()?

A

get_template_part() includes reusable PHP template files in a theme.

For example, get_template_part(‘template-parts/content’, ‘post’) loads a partial template. Freelancers use it for modular code, while enterprise architects leverage it for reusable, scalable templates.

23
Q

What are template tags in WordPress?

A

Template tags are PHP functions that output specific content, like the_title() or the_excerpt().

These tags retrieve data (e.g., post titles) or include templates (e.g., get_header()). Freelancers use them for dynamic layouts, while enterprise architects ensure consistent data rendering.

24
Q

What is a custom post type in theme development?

A

A custom post type is a user-defined content type, like portfolios or testimonials.

Registered via register_post_type() in functions.php, it requires dedicated templates (e.g., single-portfolio.php). Freelancers create them for client needs, while enterprise architects use them for structured data models.

25
What is wp_head() in a theme?
wp_head() outputs meta tags, scripts, and styles in the section. Placed in header.php, it triggers the wp_head hook for enqueued assets. Freelancers ensure it’s included for functionality, while enterprise architects optimize its output for performance and SEO.