Monday 23 November 2015

Best 40 WordPress Interview Questions and answers

1) What is WordPress?
Word press is a best Open Source CMS which allows it to be used free of cost.  You can use it on any kind of personal or commercial website without have to pay a single penny for it. It is built on PHP/MySQL (which is again Open Source) and licensed under GPL.'

WordPress CMS Interview Questions & Answers

Q: What is WordPress?
Ans: WordPress is an open source Content Management System which can be used to built websites and Blogs. WordPress was released in 2003 and it is based on PHP & MYSQL.

Saturday 21 November 2015

Examples WordPress of Hooks in Action

More than 200 hooks exist in WordPress. Below you will find a few examples of common hooks in use.
Register a Custom Menu in the Admin

How to Add and Remove Your Own Functions

If you would like to hook in your own functions, the process is quite simple. You first need to know a few pieces of information. For actions, you’ll want to know the name of the hook, as well as when exactly it runs.

Types of Action and Filter Hooks

The WordPress Codex has two important pages that can help you orient yourself with what hooks are available in WordPress.

WordPress Action Hooks and Filter Hooks

Introduction

This page documents the API (Application Programming Interface) hooks available to WordPress plugin developers, and how to use them.

Monday 31 August 2015

Does Contact Form 7 support HTML5 input types?

Yes. Contact Form 7 3.4 and higher support form-tags corresponding to these HTML5 input types: email, tel, url, number, range and date.

How to add a contact form into my post content?

Open the settings page for Contact Form 7, and then open the contact form you want to add.

Each contact form has its own tag (shortcode), such as [contact-form-7 id="1234" title="Contact form 1"]. To insert the contact form into your post, copy the shortcode and paste it into the post content.

How to Hide WooCommerce "Free" Price Label

A common WooCommerce question lately has been how to hide the “Free” price label in the product/category/shop pages. Thanks to WooCommerce’s judicious use of filters/actions, this is very easy

Friday 12 June 2015

How to Set default thumbnails size & creating multiple thumbnail sizes?

Registers a new image size. This means WordPress will create a copy of the image with the specified dimensions when a new image is uploaded.
To set the default Featured Image (formerly Post Thumbnail) dimensions use: set_post_thumbnail_size()
<?php add_image_size$name$width$height$crop ); ?>
if ( function_exists( 'add_theme_support' ) ) {
   add_theme_support( 'post-thumbnails');
   set_post_thumbnail_size( 200, 200, true );
}

What does above code really mean?

Does it mean all my thumbnails will be 800x600 or smaller? Because even after setting set_post_thumbnail_size get_post_thumbnail_id($post->ID) points to full-sized thumbnails (like 2500x1200). I don't really need that big images...

When do WordPress create (custom) thumbnails?

Set the image size by cropping the image (not showing part of it):
Set the image size by resizing the image proportionally (without distorting it):

add_image_size( 'custom-size', 220, 220, array( 'left', 'top' ) ); // Hard crop left top

When setting a crop position, the first value in the array is the x axis crop position, the second is the y axis crop position.
  • x_crop_position accepts 'left' 'center', or 'right'.
  • y_crop_position accepts 'top', 'center', or 'bottom'.
By default, these values default to 'center' when using hard crop mode.

if ( function_exists( 'add_theme_support' ) ) {
  add_theme_support( 'post-thumbnails');
  set_post_thumbnail_size( 900, 600, true );
  add_image_size( 'foo', 400, 300, true );
  add_image_size( 'bar', 200, 250, true ); 
}


When are these custom thumbnails created (like image-900x600.jpg / image-400x300.jpg etc.) ? Only during upload process? What if I'm just changing themes to theme based on add_image_size functions with different thumbnail sizes, do I have to reupload all my images to get right sizes? If yes, then using timthumb over add_image_size wasn't that bad idea..

Popular Articles