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