Courtesy:-http://www.excellentwebworld.com/wordpress-interview-question-answer/
WordPress is web software you can use to create a beautiful website or blog. We like to say that WordPress is both free and priceless at the same time.Now Most of users are started development on WordPress The main reason for its popularity is its admin very easy to use and manage.Its will work on apr. 60 million websites world wide.
So now all IT firm started hiring developer for WordPress but main thing what exact qualification we needed and exactly what knowledge we are looking for.So here is the some basic & Technical question answer that at-least developers knows.
In this blog find some technical Question & Answer of WordPress.
Que 1 How we will pass a variable by value in WordPress.
Ans. Its same like we will work in c,c++
$p = &$s
Que 2 Basic functions then we generally used in WordPress? Why?
Ans: If developer have good knowledge then he/she must know this function name at-least 3-5
1. is_page() :- Condition for check if page is displayed. Its return true or false.
2. wp_nav_menu() :- Enabling WordPress 3.0′s Navigation Menu Feature
3. wp_list_pages() :- Listing All Pages
4. get_excerpt() :- Displays the excerpt of the current post with read more link for display full post.
5. is_category() :- Condition for check if category is displayed. Its return true or false.
6. the_title():- Displays the title of the current post
7. the_content():- Displays the contents of the current post.
8. bloginfo(‘url’) :- Getting the Site’s URL
9. bloginfo(‘template_url’) :- Getting the URL to the Current Theme
10.the_time():- Display the time the post was published (uses PHP date formatting as a parameter):
Que 3 How many tables a default WordPress will have?
Ans If developer work with database then he/she must know how many table install with default wordpress.
A default wordpress will have 11 tables. They are-
1. wp_commentmeta
2. wp_comments
3. wp_links
4. wp_options
5. wp_postmeta
6. wp_posts
7. wp_terms
8. wp_term_relationships
9. wp_term_taxonomy
10.wp_usermeta
11.wp_users
Que 4 Is WordPress good for Google ranking and SEO?
Ans Yes, That is one of the major selling points of using WordPress is that it includes excellent built in search engine optimization (SEO).In Other CMS you have to install SEO extention they either free or Commercial.In WordPress you can also extend SEO feature by using some Nice FREE SEO plugins likes All in one SEO,Yoast These are popular plugins that are known to help your rank on search engines such as Google and Bing.
Que 5 How to hide the top admin bar at the frontend in WordPress.
Ans. Most of developer have no idea about this.
Add the below mentioned code in the theme(active) function.php
(or)
Add the below code in the active theme style.css stylesheet
#wpadminbar {
display: none; visibility: hidden;
}
Que 6 How to hide Directory Browsing in WordPress from server using .htaccess file?
By default when your web server does not find an index file (i.e. a file like index.php or index.html), it automatically displays an index page showing the contents of the directory.SO now if you want to hide this add below code in .htaccess file.
Que 7 What are the custom fields in wordpress? How to display it?
Ans We will add extra information to our post by using custom fields.Custom Fields are a form of meta-data that allows us to store arbitrary information with each WordPress post.
To display the Custom Fields for each post, use the the_meta() template tag.
To fetch meta values use the get_post_meta() function.
For example we use custom fields:-
Que 8 What is the use of loop in Worpdress Where we used it?
Ans. The Loop are php code used by WordPress to display posts. Using The Loop, WordPress processes each post to be displayed on the current page.check below sample code.
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
//
// Post Content here
//
} // end while
} // end if
?>
Que 9 How to run database Query in WordPress?
Ans. The $wpdb->query function allows you to execute any SQL query on the WordPress database. It is best to use a more specific function. Check sample code below for SELECT query.
// Examples
$wpdb->query( “
UPDATE $wpdb->posts
SET post_parent = 7
WHERE ID = 15
AND post_status = ‘static’ “
);
Que 10 How to Change Your Default WordPress Post Category & Post Type?
Ans. Most common issue and most of developer not know this and find hacking(custom coding solution).But it more easy then that.simply navigate to Settings > Writing > and then look for the pull down menu beside “Default Post Categoy.” for change default category selection.
Image may be NSFW.
Clik here to view.
Below that you can find Default post format for changes post type from standard to image post type or a video post type,chat gallery,link and many more.
Que 11 How to Change the Length of the Default WordPress Excerpt.
Ans The default WordPress excerpt is 55 words long. By modified bit to your functions.php file you can change the length to as you required.Below is the code if we need 60 length.
return 42;
}
add_filter(‘excerpt_length’, ‘new_excerpt_length’);
Que 12 How to add option for open menu item in new tab?
Ans. This is very basic feature but sometime developer never use this so they have no idea and goto code and add manually that links.For add option in menu item for open link in new tab just navigate to “Screen Option” at top right corner in menu select check “link target”. See below screenshot.
Image may be NSFW.
Clik here to view.
Que 13 What is hooks and types of hooks in wordpress?Where it used?
Ans. Hooks are provided by WordPress to allow your plugin to ‘hook into’ WordPress; that is, to call functions in your plugin at specific times, and thereby set your plugin in motion. There are two types of hooks used in WordPress are Actions and Filters.
1)Actions Run During a Typical Request.for example A developer may want to add code to the footer of a Theme. This could be accomplished by writing new function, then Hooking it to the wp_footer Action.
has_action()
add_action()
do_action()
do_action_ref_array()
did_action()
remove_action()
remove_all_actions()
2)Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen.
has_filter()
add_filter()
apply_filters()
apply_filters_ref_array()
current_filter()
remove_filter()
remove_all_filters()
Que 14 What is child theme? Why we used it?
Ans A WordPress child theme is a WordPress theme that inherits its functionality from its parent WordPress theme.Child themes are often used when you want to customize or tweak an existing WordPress theme without losing the ability to upgrade that theme.
Advantage is child theme is Safe Updates,Easy to Extend,Fallback Safe
Que 15 What is the Basic Difference Between Posts vs. Pages.
Ans. Posts are timely vs. Pages are timeless.
Posts are social vs. Pages are NOT.
Posts can be categorized vs. Pages are hierarchical.
Posts are included in RSS feed vs. Pages are not.
Pages have custom template feature vs. Posts do not.
Image may be NSFW.
Clik here to view.
Clik here to view.
