Wednesday, March 19, 2014

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.

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.
Writing Setting
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.

How to run database Query in WordPress?

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.

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.

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:-

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.