WordPress Interview Questions & Answers – Part3

21. Should I use print “$a dollars” or “{$a} dollars” command to print out the value of dollars in this case?
In this case the braces will not affect the outcome as the variable is all by itself.

22.  Briefly explain the procedure to pass a variable by value in WordPress?
Passing a variable by value in WordPress is similar to as that in C++. We have to just add an ampersand in front of the variable to do the task.
$X= &$Y

23. Tell me the method to define a constant?
We can define a constant by using the below provided command
define() directive
The example of defining a Constant is (“WEBGRANTH”, 100);

24. Blog is a necessary part to be included in a WordPress Website?
No it is not a necessary part. Although WP was first designed as a platform for blogging but now it can be used for every genre of websites. Blogs are added in the website to provide valuable information to the visitor and for a better SEO.

25.  What is the simplest way to find out the number of parameters passed into a function?
It is really easy to find out the no. of parameters passed into the function by following the below provided command:

26.  Basic functions then we generally used in WordPress? Why?
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)

27. How can you backup or import your WordPress content from admin panel.
For import content from wordpress admin panel goes to:-
WordPress admin -> Tools -> Import
This will create a xml file for your posts, comments, category etc.

28. What is file structure in wordpress.
The main files used in wordpress are:-

  1. index.php :- for index page.
  2. single.php :- for single post page.
  3. page.php :- display the static pages.
  4. category.php :-  Display the category page.
  5. archive.php :- For archive page display.
  6. tag.php :- For display the tags page.
  7. author.php :- For display author page.
  8. search.php :- For display the search result page.
  9. 404.php :- For display 404 error page.
  10. taxonomy.php :- For display the taxonomy archive.
  11. attachment.php :- For managing the single attachments page.
  12. header.php :- For managing top part of page.
  13. footer.php :- For manage bottom part of pages.

29. What are the template tags in wordpress.
A template tag is code that instructs WordPress to “do” or “get” something. Like in header.php  we will use the tag bloginfo(‘name’) to get information from user profile.
The the_title() template tag is used to display the post title.
wp_list_cats() are  for display categories.
get_header() for getting header.
get_sidebar() for display the sidebar on page.
get_footer() for get the footer content on page.

30. What are the custom fields in wordpress.
We will add extra information to your post by using custom fields. Custom Fields are a form of meta-data that allows you to store arbitrary information with each WordPress post.
Meta-data is handled with key/value pairs. The key is the name of the meta-data element. The value is the information that will appear in the meta-data list on each individual post that the information is associated with.
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:-
<?php echo get_post_meta($post->ID, ‘key’, true); ?>

Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

Leave a Reply

Your email address will not be published. Required fields are marked *

three + = 7

Popup Dialog Box Powered By : XYZScripts.com
  • RSS
  • Facebook
  • Google+
  • Twitter