What is the output of the following code?
<ul id="sortable">
<li id="1">example 1</li>
<li id="2">example 2</li>
<li id="3">example 3</li>
<li id="4">example 4</li>
</ul>
$(document).ready(function(){
$('#sortable').sortable({
update: function(event, ui) {
var newOrder = $(this).sortable('toArray').toString();
$.get('saveSortable.php', {order:newOrder});
}
});
});
Removes positions from data base based on the user input
Saves sortable positions to data base based on the user input==ans
Adding new sortable positions from another data base
Sorting out existing positions without updating the data base with the new user inputs
//////////////
display it on another?
switch_blog()
switch_to_blog()==ans
restore_current_blog()
restore_to_current_blog()
How can the upload media panel be included in a Wordpress template/plugin?
By using function wp_enqueue_script('media-upload')
By using function wp_add_media( );
By using function wp_enqueue_script('upload');==ans
By using function wp_add_script('media-upload');
Which of the following is a quick way to move a Wordpress website from one server to another?
Using migration plugin
Copying wordpress files and database from source to destination server==ans
Using XML export through wp-admin interface
Install new wordpress and copy theme and plugin directory
Which of the following functions can be used to create a WordPress page?
wp_insert_post()==ans
wp_insert_page()
wp_create_post()
wp_create_page()
How can a user be found through its meta data?
User can not be retrieved through its meta data
get_user_by_metadata($metaid,$metavalue)
get_user($args)
get_users($args)==ans
Which of the following commands can change the ownership of WordPress directory to www-data (for Apache)?
sudo chown -Rf www-data *
chown -Rf www-data *
sudo crown -Df www-data * ==ans
Alldo chown -Rf www-data *
User Level 7 converts to _________?
Contributor
Author
Editor==ans
Subscriber
Administrator
How can a post ID be retrieved from the permalink?
Its not possible to retrieve the post ID from a permalink due to its structure.
It can be retrieved by using a Regular Expression.
wp_get_post_id($permalink)
url_to_postid($permalink)
Which of the following will hash a string/password to its md5 equivalent?
md5()
wp_generate_password()===ans
wp_generate_md5()
password_md5()
What is the BEST way to get last inserted row ID from Wordpress database ?
Use the following code snippet
$lastid->$wpdb=$last->get_row;
The call to mysql_insert_id() inside a transaction should be added:
mysql_query('BEGIN');
// Whatever code that does the insert here.
$id = mysql_insert_id(); ==ans
mysql_query('COMMIT');
// Stuff with $id.
The following code snippet should be added
$last = $wpdb->get_row("SHOW TABLE STATUS LIKE 'table_name'");
$lastid = $last->Auto_increment;
Straight after the $wpdb->insert() insert, the following code should be added:
$lastid = $wpdb->insert_id;
Which of the following is the correct sequence of steps to adapt a WordPress plugin to a multisite?
a) ==ans
1. Use $wpdb to iterate through all blogs
2. Hook according to the $blog_id
3. Install the plugin as Network only
4. Uninstall depends the specific plugin
1. Use $wp_posts to iterate through all blogs
2. Hook according to the $function
3. IInstall the plugin as Network only
4. Uninstall depends the specific plugin
1. Use $wp_posts to iterate through all blogs
2. Hook according to the $function
3. Install other activations except Network
4. Uninstall is the same for all the plugins
1. Use $wp_posts to iterate through all blogs
2. Hook according to the $function
3. Install the plugin as Network only
4. Uninstall is same for all the plugins
Which of the following will correctly load localized (translated) text for a WordPress plugin?
function custom_theme_setup() {
$lang_dir = get_template_directory() . '/lang');
load_theme_textdomain('tutsplus', $lang_dir);
}
add_action('after_setup_theme', 'custom_theme_setup');
function custom_theme_setup() {
$lang_dir = get_template_directory() . '/lang');
add_action('after_setup_theme', 'custom_theme_setup');
}
function custom_theme_setup() {
$lang_dir = get_template_directory() . '/lang');
add_action('after_setup_theme', 'custom_theme_setup');
}
load_theme_textdomain('tutsplus', $lang_dir);
function load_theme_textdomain('tutsplus', $lang_dir); {
$lang_dir = get_template_directory() . '/lang');
custom_theme_setup();
}
add_action('after_setup_theme', 'custom_theme_setup');
Which of the following is the correct way to assign a category to a Wordpress post?
wp_set_post_categories($postId,$categories)==ans
wp_set_category($catId,$postId)
By XML-RPC call to wpc.newPost
This is not possible
Which of the following will show the most recent post (by date) from a custom taxonomy?
a) ans
select * from wp_posts where ID in(
select ID from
(
select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a
join wp_term_relationships as b on ( a.ID = b.object_id)
join wp_term_taxonomy as c on (b.term_taxonomy_id = c.term_taxonomy_id)
join wp_terms as d on (c.term_id = d.term_id)
where c.taxonomy = 'post-series'
group by d.name
having (wp_posts.post_date = max(wp_posts.post_date))
)tmp)
select * from wp_posts where ID in(
select ID from
(
select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a
join wp_terms as d on (c.term_id = d.term_id)
where c.taxonomy = 'post-series'
group by d.name
having (wp_posts.post_date = max(wp_posts.post_date))
)tmp)
select * from wp_posts where ID in(
select ID from
(
select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a
join wp_term_relationships as b on ( a.ID = b.object_id)
join wp_term_taxonomy as c on (b.term_taxonomy_id = c.term_taxonomy_id)
join wp_terms as d on (c.term_id = d.term_id)
having (wp_posts.post_date = max(wp_posts.post_date))
)tmp)
select * from wp_posts where ID in(
select ID from
(
select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a
join wp_term_relationships as b on ( a.ID = b.object_id)
join wp_terms as d on (c.term_id = d.term_id)
where c.taxonomy = 'post-series'
group by d.name
having (wp_posts.post_date = max(wp_posts.post_date))
)tmp)
How can a custom content filter be added?
By using add_action('the_content','my_custom_filter')==ans
By using add_filter('the_content','my_custom_filter')
By using wp_filter('the_content','my_custom_filter')
By using add_action('content','my_custom_filter')
You can limit the number of revisions WordPress stores by _____
<b>Note:</b> Categories must have distinct slugs. Even if two categories have different parents and would therefore have different permalinks, you can't assign them the same slug.
Note: There may be more than one right answer.
adding the following line to your wp-config.php file: define('WP_POST_REVISIONS', 3);
using a plugin
changing a setting on admin panel
Which of the following code snippets can be used to create custom POST status in wordpress 3.0 +?
register_new_post()
register_post_status()==ans
add_new_post_status()
modify_post_status()
Which of the following will correctly add custom mod rewrite rules to .htaccess from a WordPress plugin?
$custom_mod_rewrite = new custom_mod_rewrite;
register_activation_hook( __FILE__, array($custom_mod_rewrite, 'flush_rewrite_rules'));
register_deactivation_hook( __FILE__, array($custom_mod_rewrite, 'flush_rewrite_rules'));
add_action('generate_rewrite_rules', array($custom_mod_rewrite, "generate_rewrite_rules"));
class custom_mod_rewrite {
function __construct() {
$this->wp_rewrite = & $POST["wp_rewrite"];
}}
$custom_mod_rewrite = new custom_mod_rewrite;
register_activation_hook( __FILE__, array($custom_mod_rewrite, 'flush_rewrite_rules'));
register_deactivation_hook( __FILE__, array($custom_mod_rewrite, 'flush_rewrite_rules'));
add_action('generate_rewrite_rules', array($custom_mod_rewrite, "generate_rewrite_rules"));
class custom_mod_rewrite {
function __construct() {
$this->wp_rewrite = & $GLOBALS["wp_rewrite"];
}
}
$custom_mod_rewrite = new custom_mod_rewrite;
register_activation_hook( __FILE__, array($custom_mod_rewrite, 'flush_rewrite_rules'));
register_deactivation_hook( __FILE__, array($custom_mod_rewrite, 'flush_rewrite_rules'));
add_action('generate_rewrite_rules', array($custom_mod_rewrite, "generate_rewrite_rules"));
class custom_mod_rewrite {
function __construct() {
$this->wp_rewrite = & $GLOBALS["wp_rewrite"];
}
function mod_rewrite_rules($rules) {
return preg_replace('#^(RewriteRule \^.*/)\?\$plugin_name .*(http://.*) \[QSA,L\]#mi', '$1 $2 [R=301,L]', $rules);
}
}
$custom_mod_rewrite = new custom_mod_rewrite;
register_activation_hook( __FILE__, array($custom_mod_rewrite, 'flush_rewrite_rules'));
register_deactivation_hook( __FILE__, array($custom_mod_rewrite, 'flush_rewrite_rules'));
add_action('generate_rewrite_rules', array($custom_mod_rewrite, "generate_rewrite_rules"));
class custom_mod_rewrite {
function __construct() {
$this->wp_rewrite = & $SESSION["wp_rewrite"];
}
}
Which of the following is the correct way to get WordPress Post ID from the Post title?
$page = get_page_title( 'About' );
wp_pages( 'exclude=' . $page->ID );
$page = get_page_by_title( 'Home' );
$page_id = $page->ID;
$page = get_page_by_title( 'About' );==ans
wp_pages( 'exclude=' . $page->ID );
None of the above
Which of the following methods can be used to make permalinks SEO friendly?
Updating the database.
Changing the source code.
Configuring the feature in the config file.
Configuring the feature in the admin settings.==ans
Image size limits can be set _______________.
directly in the posts
in the wp-imageresize plug-in
in the admin settings==ans
both directly in the posts and in the wp-imageresize plug-in
What is the first action you need to take for enabling the WordPress multisite (MS) feature?
Enable the WordPress multisite feature on admin panel
Enable the Network feature
Add this code to wp-config.php file: define( 'WP_ALLOW_MULTISITE', true );==ans
Which of the following codes will return the current plugin directory in WordPress?
<?php plugin_basename($file); ?>/=ans
<?php plugin_basename('url'); ?>
<?php bloginfo_plugin('url'); ?>
<?php content_plugin_url( $path ); ?>
Are categories and tags available for pages?
<b>Note:</b> Categories must have distinct slugs. Even if two categories have different parents and would therefore have different permalinks, you can't assign them the same slug.
Yes
No==ans
Which of the following will give the option to add inline Ajax for comment posting?
Enabling Ajax in the wp-config.php file
Activating Ajax from the admin settings of WordPress
Using the Ajax Comment Posting plugin=ans
Wordpress doesn't support inline Ajax.