Edu
Hub
Courses
AI Tools
Leaderboard
Login/Register
AR
Abdullah Rashid
abdullah@example.com
Navigation
📚
Courses
🏆
Leaderboard
✨
AI Tools
←
WordPress and jQuery Intermediate Quiz
⏱
15:00
Quit
0 / 20 answered
0%
WordPress and jQuery Intermediate Quiz
10 questions · Medium difficulty · 00:20:00 min
🔥 In Progress
Question 1
What is the correct way to enqueue a jQuery script in WordPress?
wp_enqueue_script('my-script', array('jquery'));
wp_register_script('jquery', 'https://code.jquery.com/jquery-3.6.0.min.js');
wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery.js');
wp_enqueue_script('jquery');
Question 2
Which WordPress action hook is used to enqueue scripts and styles on the front end?
init
wp_enqueue_scripts
admin_enqueue_scripts
wp_head
Question 3
In jQuery, what does the `$` sign represent?
A shortcut for jQuery function
A selector for IDs
A variable for document
An alias for window
Question 4
How do you prevent jQuery conflicts in WordPress when using the `$` alias?
document.addEventListener('DOMContentLoaded', function() { ... });
jQuery(document).ready(function($) { ... });
wp_enqueue_script('jquery'); and then use $ directly
$(document).ready(function() { ... });
Question 5
Which WordPress filter allows modification of the query before it is executed?
the_posts
pre_get_posts
posts_where
wp_query
Question 6
What jQuery method is used to perform an AJAX request?
All of the above
$.post()
$.getJSON()
$.ajax()
Question 7
In WordPress, how do you pass PHP variables to an enqueued script?
wp_localize_script()
echo '<script>var data = ' . json_encode($data) . ';</script>';
wp_add_inline_script()
wp_enqueue_script() with a data attribute
Question 8
What does the jQuery selector `$('div p')` select?
All <p> elements that are descendants of <div>
All <div> and <p> elements
All <div> elements inside <p>
All <p> elements that are direct children of <div>
Question 9
Which WordPress function is used to get the URL of the theme directory?
theme_url()
get_template_directory_uri()
get_stylesheet_directory_uri()
home_url()
Question 10
What is the purpose of `wp_footer` action hook?
To add custom footer text
To include footer.php template
To output scripts and content before the closing body tag
To enqueue scripts in the footer
Question 11
In jQuery, how do you attach a click event to a button with id `myButton`?
$('button#myButton').bind('click', function() { ... });
$('#myButton').on('click', function() { ... });
$('#myButton').click(function() { ... });
All of the above are correct
Question 12
Which WordPress function is used to retrieve post meta data?
get_post_meta()
get_metadata()
post_meta()
the_meta()
Question 13
What does the jQuery method `.fadeOut()` do?
Hides the matched elements by fading them to transparent
Slides up the matched elements
Removes the matched elements from the DOM
Changes opacity to 0 instantly
Question 14
How do you create a custom WordPress shortcode?
wp_shortcode('myshortcode', 'callback_function');
register_shortcode('myshortcode', 'callback_function');
create_shortcode('myshortcode', 'callback_function');
add_shortcode('myshortcode', 'callback_function');
Question 15
In jQuery, what is the difference between `.text()` and `.html()`?
.text() retrieves HTML, .html() retrieves text
Both retrieve the same thing
.text() is deprecated
.text() retrieves plain text, .html() retrieves HTML content
Question 16
Which WordPress action is triggered after a post is saved?
wp_insert_post
publish_post
post_updated
save_post
Question 17
How do you select an element by its class name in jQuery?
$('.myClass')
$('[class=myClass]')
$('myClass')
$('#myClass')
Question 18
What is the correct way to check if a checkbox is checked in jQuery?
Both A and C are correct
$('#myCheckbox').prop('checked')
$('#myCheckbox').attr('checked')
$('#myCheckbox').is(':checked')
Question 19
Which WordPress function is used to generate a nonce field for security?
nonce_field()
check_admin_referer()
wp_create_nonce()
wp_nonce_field()
Question 20
In jQuery, what does `$(this)` refer to inside an event handler?
The window object
The parent element
The document object
The DOM element that triggered the event
✅ Answered:
0
⬜ Unanswered:
8
📊
20%
done
Submit Answers →