Menu bar

Wednesday 30 December 2015

Wordpress interview questions and answers

How to store the post title in variable?
  $page_title = get_the_title($post->post_parent);

How to Generates a random password of the specified length in WordPress?
<?php generate_random_password($len) ?>

How to hide the Admin Bar in WordPress?
add_filter('show_admin_bar', '__return_false');

 How to get the postid in wordpress?
global $wp_query;
$postid = $wp_query->post->ID;
echo $postid;

 How to get the post meta value in worpdress?
we can get the post meta value throw postid.
for example here post Custom Field name : comapny name
 get_post_meta($postid, 'Company name', true);


 How to check if the post has a Post Thumbnail assigned to it.
if ( has_post_thumbnail() )  // check if the post has a Post Thumbnail assigned to it.
   { 
the_post_thumbnail();
   }


How to get the wordpress featued image and how to change the image width and height.

we can get the featurd image wordpress function

 the_post_thumbnail();//here we can get the wordpress featured image thumbnail
  the_post_thumbnail( array(100,100) );     // here we can change the image size.

How to get the specified category post only in wordpress?
<?php query_posts("cat=106 && per_page=5");// here 106 is the category id  ?>
<?php while ( have_posts() ) : the_post(); ?>
<h3><?php the_title(); // here we can get the post title. this is the wordpress free defind function ?></h3>
<?php  endwhile; ?>

What is the prefix of wordpress tables by default?
 By default, wp_ is prefix of wordpress.

How can we backup or import our WordPress content from admin panel?
 For import content from wordpress admin panel goes to
WordPress admin -> Tools -> Import


Can wordPress use cookies?
Yes, wordpress use cookies.WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users.

How to disable wordpress comment?
 Look in to dashboard under Options –> Discussion. There is a checkbox there for “allow people to post comments on the article” Try unchecking that.

How many tables a default WordPress will have?

 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

What are the features of wordpress?
1. Simplicity,Make wordpress to manage easily that is its very easy to use.
2. Free open source ,its free to use wordpress.
3. Easy theme system,In wordpress we have thousand of good free theme to use.
4. Extends with plugins, we can extends the functionality of wordpress using thousands of free plugins or will create any plugin according to your requirements.
5. Community,WordPress has vibrant and supportive community.
6. Multilingual, wordpress is available on more than 70 languages.
7. Flexibility, with wordpress you will create any type of blog or website.
8. Comment, the built in comment system also make wordpress popular as you can comment your views on website.
9. Easy installation and upgrades.
10. Full standards compliance, Easy Importing,Cross-blog communication tools.

No comments: