0
0
Wordpressframework~10 mins

CMS architecture overview in Wordpress - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the main WordPress configuration file name.

Wordpress
<?php
// The main configuration file is named [1]
Drag options to blanks, or click blank then click option'
Aindex.php
Bfunctions.php
Cwp-config.php
Dstyle.css
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing the configuration file with theme files.
Using 'index.php' as the config file name.
2fill in blank
medium

Complete the code to show how WordPress loads plugins from the {{BLANK_1}} directory.

Wordpress
<?php
$plugin_dir = WP_CONTENT_DIR . '/[1]';
// Plugins are loaded from this directory
Drag options to blanks, or click blank then click option'
Acache
Buploads
Cthemes
Dplugins
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'themes' instead of 'plugins'.
Confusing uploads folder with plugins.
3fill in blank
hard

Fix the error in the code to correctly include the WordPress core file.

Wordpress
<?php
require_once(ABSPATH . '[1]');
Drag options to blanks, or click blank then click option'
Awp-settings.php
Bwp-config.php
Cindex.php
Dfunctions.php
Attempts:
3 left
💡 Hint
Common Mistakes
Including 'wp-config.php' here causes errors.
Using theme files instead of core files.
4fill in blank
hard

Fill both blanks to create a WordPress hook that runs a function on initialization.

Wordpress
add_action('[1]', '[2]');

function my_init_function() {
  // Initialization code here
}
Drag options to blanks, or click blank then click option'
Ainit
Bwp_head
Cmy_init_function
Dwp_footer
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing hook names with function names.
Using hooks that run too late or too early.
5fill in blank
hard

Fill all three blanks to register a custom post type in WordPress.

Wordpress
function register_[1]_post_type() {
  register_post_type('[2]', [
    'labels' => ['name' => '[3]'],
    'public' => true,
  ]);
}
add_action('init', 'register_[1]_post_type');
Drag options to blanks, or click blank then click option'
Abook
CBooks
Dmovie
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for function and post type slug.
Incorrect label casing or spelling.