How to Send HTML Emails From WordPress Using wp_mail Function

How to Send HTML Emails From WordPress Using wp_mail Function.
Yes you can use WordPress’s wp_mail() function to send HTML emails from your WordPress site. However, the default content type of wp_mail() function is set to ‘text/plain’ which does not allowed you to send HTML in emails. If you want to send HTML emails using the WordPress wp_mail() function then you will need to set the content type of the email to “text/html” by using the ‘wp_mail_content_type’ filter. This is how you can do that:

Before you send your wp_mail() call add a filter to wp_mail_content_type. You can add this filter which is shown below.

[php] add_filter(‘wp_mail_content_type’,’set_content_type’); [/php]

Then create a function set_content_type and in that function have to return the appropriate content type, in this case it is ‘text/html’. See below

function set_content_type($content_type){
return ‘text/html’;

Another Way to Set the Mail Content Type to HTML


add_filter(‘wp_mail_content_type’,create_function(”, ‘return “text/html”; ‘));
wp_mail(‘’, ‘Email Subject’, ‘Email Message Body’);


11 Best WordPress Testimonial Plugins 2018

Testimonials are essential in building trust with potential customers. If you are buying some product or service then you need some positive things about the service provider. Then we are looking for previous testimonials or reviews about that provider. So here we are created a list of best testimonials plugin for you.

1. Testimonials Widget

[wpplugin title=”Testimonials Widget” image_large=”×250.jpg” image_thumbnail=”×128.jpeg” plugin_author=”Axelerant” plugin_author_url=”” plugin_ratings=”86″ plugin_ratings_url=”” plugin_download=”50,000″ plugin_download_url=”” plugin_tested=”4.8.4″ plugin_url=””] Testimonials Widget lets you randomly slide or list selected portfolios, quotes, reviews, or text with images or videos on your WordPress site. You can insert Testimonials content via shortcode, theme functions, or widgets with category and tag selections and having multiple display options such as random or specific ordering.

2. Testimonial Rotator

[wpplugin title=”Testimonial Rotator” image_large=”×250.jpg” image_thumbnail=”×128.png” plugin_author=”Hal Gatewood” plugin_author_url=”Hal Gatewood” plugin_ratings=”” plugin_ratings_url=”” plugin_download=”40,000″ plugin_download_url=”” plugin_tested=”4.9.1″ plugin_url=””]Finally a really simple way to manage testimonials on your site. This plugin creates a testimonial and a testimonial rotator custom post type, complete with WordPress admin fields for adding testimonials and assigning them to rotators for display. It includes a Widget and Shortcode to display the testimonials.

3. Easy Testimonials

[wpplugin title=”Easy Testimonials” image_large=”×250.jpg?rev=1101417″ image_thumbnail=”×128.png?rev=1101417″ plugin_author=”Gold Plugins” plugin_author_url=”” plugin_ratings=”” plugin_ratings_url=”” plugin_download=”40,000″ plugin_download_url=”” plugin_tested=”4.5.0″ plugin_url=””]

4. Strong Testimonials

[wpplugin title=”Strong Testimonials” image_large=”×250.png” image_thumbnail=”×128.png” plugin_author=”Chris Dillon” plugin_author_url=”” plugin_ratings=”” plugin_ratings_url=”” plugin_download=”30,000″ plugin_download_url=”” plugin_tested=”3.7″ plugin_url=””]A flexible testimonials plugin that works right out of the box for beginners with advanced features for pros, backed by strong support.

5. Testimonial Basics

[wpplugin title=”Testimonial Basics” image_large=”×250.jpg” image_thumbnail=”×128.jpg” plugin_author=”Kevin Archibald” plugin_author_url=”” plugin_ratings=”” plugin_ratings_url=”” plugin_download=”9,000″ plugin_download_url=”” plugin_tested=”4.6″ plugin_url=””]Testimonial Basics is a full featured testimonial management plugin.

6. WP Testimonials with rotator widget

[wpplugin title=”WP Testimonials with rotator widget” image_large=”×250.png” image_thumbnail=”×128.png” plugin_author=”WP Online Support” plugin_author_url=”” plugin_ratings=”” plugin_ratings_url=”” plugin_download=”8,000″ plugin_download_url=”” plugin_tested=”3.1″ plugin_url=””]Many CMS site needs to display client’s testimonial on their website. WP Testimonial Plugin with Widget allow you to add testimonial
from wp-admin side same like you add post, which allows you to display testimonials on your website the easy way.

7. Handsome Testimonials

[wpplugin title=”Handsome Testimonials” image_large=”×250.png?rev=1544537″ image_thumbnail=”×128.png?rev=1544536″ plugin_author=”Ristretto Apps” plugin_author_url=”” plugin_ratings=”” plugin_ratings_url=”” plugin_download=”3,000″ plugin_download_url=”” plugin_tested=”4.0″ plugin_url=””]Handsome Testimonials by Ristretto Apps lets you easily display attractive and eye catching testimonials on your site that evoke your customer’s trust, made easy with Handsome Testimonials by Ristretto Apps. Handsome Testimonials by Ristretto Apps gives you, the WordPress user, super-powers with the ability to magically create great looking testimonials right from the get-go. The plugin comes with modern testimonial designs that can be highly customized.

8. Testimonial

[wpplugin title=”Testimonial” image_large=”×250.png?rev=1758433″ image_thumbnail=”×128.png?rev=1758433″ plugin_author=”ShapedPlugin” plugin_author_url=”” plugin_ratings=”” plugin_ratings_url=”” plugin_download=”4,000″ plugin_download_url=”” plugin_tested=”4.0″ plugin_url=””]Testimonial is a Clean, Easy-to-use and Powerful Testimonials Management System for WordPress. This plugin will help you to display easily attractive and eye catching Unlimited testimonials, reviews or quotes in multiple ways anywhere (like post, page, custom template, sidebar, widget) of your site using shortcode.

9. Testimonials

[wpplugin title=”Testimonials” image_large=”×250.png” image_thumbnail=”×128.png” plugin_author=”Themepoints” plugin_author_url=”” plugin_ratings=”” plugin_ratings_url=”” plugin_download=”3,000″ plugin_download_url=”” plugin_tested=”3.8″ plugin_url=””]Testimonials is an easy to use plugin that allows users to add Testimonials to the sidebar, as a widget, or to embed testimonials into a Page or Post using the shortcode. Testimonials also allows you to insert a list of all Testimonials or output a Random Testimonial. Testimonial is 100% responsive for all devices.

10. WP Testimonial Widget

[wpplugin title=”WP Testimonial Widget” image_large=”×250.jpg?rev=1748070″ image_thumbnail=”×128.jpg?rev=1748070″ plugin_author=”Stark Digital” plugin_author_url=”” plugin_ratings=”” plugin_ratings_url=”” plugin_download=”2,000″ plugin_download_url=”” plugin_tested=”4.0″ plugin_url=””] Using WP Testimonial Widget, you are able to manage the testimonials for your website. You can specify the number of testimonials to be displayed on your site on page or post or in widget. You can also use quicktag to insert shortcode. You can also re-order the testimonial by drag and drop UI. Now you can categorized your testimonial by adding category in to it. CSS can be uploaded in back end by setting menu.

11. BNE Testimonials

[wpplugin title=”BNE Testimonials” image_large=”×250.jpg?rev=1408518″ image_thumbnail=”×128.png?rev=1408517″ plugin_author=”Kerry Kline” plugin_author_url=”” plugin_ratings=”” plugin_ratings_url=”” plugin_download=”5,000″ plugin_download_url=”” plugin_tested=”4.5″ plugin_url=””]BNE Testimonials makes it easy to add Testimonials and Reviews to any Page using a shortcode or in a sidebar (widget area) using the provided widgets. Each testimonial includes a title, image, tagline, website URL, and message. You can also separate your testimonials into different groups (categories). BNE Testimonials will inherit the styling from your theme – just install and get to work adding your testimonials and reviews!

How to Change the Default Image Sizes in WordPress Admin Panel

Change the Default Image Sizes in WordPress Admin

In WordPress there are 3 default image sizes are there and these default image sizes are 150px * 150px for Thumbnail, 300px * 300px for Medium size and 1024px for Large size.

To change these default image size settings, there is no need of any plugin. You can manage these settings from WordPress admin panel, Go to Settings >> Media and add new values.

How to Defer Parsing of JavaScript in WordPress

The most important one for a WordPress site is its speed and performance. So this is the reason why we should defer parsing of Javascript in wordpress.

So in order to load a page, the browser must parse the contents of all <script> tags, which adds additional time to the page load. This means that if you have lots of JS or <script> tags, it will take more time for the website’s content to appear, as it first waits for all the JavaScript to load.

By minimizing the amount of JavaScript needed to render the page and by defer parsing of JavaScript, the website would not wait for the JS code to load, which would result in a quicker loading time, so you can reduce the initial load time of your page.

When you check your website in the Pingdom, GTMetrix or Google’s Page insights, you will get “Defer loading of javascript” warning. If you get this warning, then you should follow the steps below.

How To Defer Parsing Javascript?

You can enable defer parsing for JavaScript just by adding ‘defer’ attribute. For example

How To Defer Parsing Javascript in WordPress?

To defer parsing of JS in WordPress, add the below code to the bottom of your theme’s functions.php file.

if (!(is_admin() )) {
    function defer_parsing_of_js ( $url ) {
        if ( FALSE === strpos( $url, '.js' ) ) return $url;
        if ( strpos( $url, 'jquery.js' ) ) return $url;
        return "$url' defer ";
    add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );

So we have learned how to improve the speed and performance of your website or WordPress powered website by deferring parsing of JavaScript. Remember, the faster and smoother your site is, the more traffic and happier visitors you will have!

Add Custom CSS to WordPress admin dashboard

Using this snippet you can add custom CSS to WordPress admin dashboard.

In WordPress admin panel, you can also add CSS code to customize the look and feel of WP Admin Area. You can easily achieve this by creating a simple function and adding it to your current functions file (functions.php).

Below is an example function that you can use:


add_action(‘admin_head’, ‘custom_css_admin_panel’);

function custom_css_admin_panel() {
echo ‘



How to Create Custom Post type in WordPress

How to Create Custom Post type in WordPress

What is Post Type in WordPress

WordPress can display many types of content. In wordpress we create “Posts, Pages”, it is also a post type called “post, page” respectively. There are some default post types in wordpress, these are

  • Post (Post Type: ‘post’)
  • Page (Post Type: ‘page’)
  • Attachment (Post Type: ‘attachment’)
  • Revision (Post Type: ‘revision’)
  • Navigation menu (Post Type: ‘nav_menu_item’)

What is Custom Post Type

These are the new post type that you can create using register_post_type() function in wordpress. Call this function using wordpress hook, good hook to call this function is init hook.

Below is an example to create “Product” post type using register_post_type() function.


function register_product_posttype() {

$labels = array(
‘name’ => _x( ‘Products’, ‘Post Type General Name’, ‘text_domain’ ),
‘singular_name’ => _x( ‘Product’, ‘Post Type Singular Name’, ‘text_domain’ ),
‘menu_name’ => __( ‘Product’, ‘text_domain’ ),
‘parent_item_colon’ => __( ‘Parent Product:’, ‘text_domain’ ),
‘all_items’ => __( ‘All Products’, ‘text_domain’ ),
‘view_item’ => __( ‘View Product’, ‘text_domain’ ),
‘add_new_item’ => __( ‘Add New Product’, ‘text_domain’ ),
‘add_new’ => __( ‘New Product’, ‘text_domain’ ),
‘edit_item’ => __( ‘Edit Product’, ‘text_domain’ ),
‘update_item’ => __( ‘Update Product’, ‘text_domain’ ),
‘search_items’ => __( ‘Search Products’, ‘text_domain’ ),
‘not_found’ => __( ‘No Products found’, ‘text_domain’ ),
‘not_found_in_trash’ => __( ‘No Products found in Trash’, ‘text_domain’ ),
$args = array(
‘label’ => __( ‘product’, ‘text_domain’ ),
‘description’ => __( ‘Product information pages’, ‘text_domain’ ),
‘labels’ => $labels,
‘supports’ => array( ‘title’, ‘editor’, ‘excerpt’, ‘author’, ‘thumbnail’, ‘comments’),
‘hierarchical’ => false,
‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘show_in_nav_menus’ => true,
‘show_in_admin_bar’ => true,
‘menu_position’ => 5,
‘can_export’ => true,
‘has_archive’ => true,
‘exclude_from_search’ => false,
‘publicly_queryable’ => true,
‘capability_type’ => ‘post’,
register_post_type( ‘product’, $args );


// Hook into the ‘init’ action
add_action( ‘init’, ‘register_product_posttype’, 0 );


How to Create Custom Post type in WordPress

After integrating this code in your themes functions.php, you will see a menu entry of your custom post type in your wordpress admin.

You should be able to add posts, view the post list in the admin and also visit the published posts on the website.

Note: After adding CPT in your wordpress admin you need to update your permalinks.

How To Add Favicon icon to the WordPress Admin & Login Pages

How To Add Favicon icon to the WordPress Admin & Login Pages

Add following in your theme’s functions.php file, or into a custom plugin:

function add_favicon() {
  	$favicon_url = get_stylesheet_directory_uri() . '/images/favicon.ico';
	echo '<link rel="shortcut icon" href="' . $favicon_url . '" />';
add_action('login_head', 'add_favicon');
add_action('admin_head', 'add_favicon');


Add a Taxonomy Filter to your admin list for Custom Post Type

How to Add a Taxonomy Filter to your admin list for Custom Post Type

This tutorial explains you to enable “taxonomy filter” for any of your custom post type you created, in listing view of custom post type. This will allow you to filter the entries of custom post type by the term within a custom taxonomy attached to that post type.

For example, if you have a custom post type called “Books”, with a taxonomy called “Genre” attached to it, you could enable the filter for Genres and then be able to view only books filed in the “Fantasy” genre from the admin mange posts screen.

Add this below function to your theme functions.php




function book_add_taxonomy_filters() {
global $typenow;

// an array of all the taxonomies you want to display. Use the slug
$taxonomies = array(‘genre’);

// must set this to the post type you want the filter(s) displayed on
if( $typenow == ‘book’ ){

foreach ($taxonomies as $tax_slug) {
$tax_obj = get_taxonomy($tax_slug);
$tax_name = $tax_obj->labels->name;
$terms = get_terms($tax_slug);
if(count($terms) > 0) {
echo "<select name=’$tax_slug’ id=’$tax_slug’ class=’postform’>";
echo "<option value=”>Show All $tax_name</option>";
foreach ($terms as $term) {
echo ‘<option value=’. $term->slug, $_GET[$tax_slug] == $term->slug ? ‘ selected="selected"’ : ”,’>’ . $term->name .’ (‘ . $term->count .’)</option>’;
echo "</select>";
add_action( ‘restrict_manage_posts’, ‘book_add_taxonomy_filters’ );


Bloginfo Function Shortcode

Bloginfo Function Shortcode

The bloginfo() function in WordPress gives you access to lots of useful information about your site. Here is the complete list. This can be used inside Page/Post content itself using shortcode, here we can make a shortcode to return the values. Add this functin to your functions.php file in your theme:


function qt_bloginfo_shortcode( $atts ) {
‘key’ => ”,
), $atts));
return get_bloginfo($key);
add_shortcode(‘bloginfo’, ‘qt_bloginfo_shortcode’);


Now you can output any of the values by calling that shortcode with attribute “key”. For example, the name of your site:

[bloginfo key=’name’]

<img src="[bloginfo key=’template_url’]/images/logo.jpg" alt="[bloginfo key=’name’] logo" />

How to Remove Width and Height Attributes From Inserted Images in WordPress

How to Remove Width and Height Attributes From Inserted Images.
When we upload an image through the WordPress media uploader and then insert it into the tinyMCE editor, it comes with height & width attributes. But if you want to remove the insert action from adding these attributes, you can add this code to you functions.php file or a functionality plugin of your own making:


add_filter( ‘post_thumbnail_html’, ‘remove_width_attribute’, 10 );
add_filter( ‘image_send_to_editor’, ‘remove_width_attribute’, 10 );

function remove_width_attribute( $html ) {
$html = preg_replace( ‘/(width|height)="\d*"\s/’, "", $html );
return $html;


WordPress 3.8 Icons for your Custom Post Types in the Admin Menu

New look of WordPress 3.8 admin is really exciting. I discovered that the new icons are packaged as an icon font and loaded by default admin the admin panel, so we use these icons with a little
css and markup. Here we use these icons for custom post type.

WordPress 3.8 Icons for your Custom Post Types in the Admin Menu.

There is a new option for menu_icon argument of the register_post_type function. We can pass any of the following argument in menu_icon.

  • the url of an image to be used for the icon
  • a “dashicons” helper class
  • a base64-encoded SVG using a data URI string

Step 1 –

Custom post type menu items by default are given the class “menu-icon-post”, which gives it the default pushpin icon. However, you can simply pass an empty string in the menu_icon argument, and a custom icon class will be added to the menu item. So, when registering an “Events” post type, adding ‘menu_icon’ => ” will result in the menu item being given the class “menu-icon-events”. This allows us to quite easily alter the icon used.

$post_type_args = array(
‘labels’ => $labels,
‘singular_label’ => __(‘Event’),
‘public’ => true,
‘show_ui’ => true,
‘publicly_queryable’ => true,
‘query_var’ => true,
‘exclude_from_search’ => false,
‘show_in_nav_menus’ => true,
‘capability_type’ => ‘post’,
‘has_archive’ => true,
‘hierarchical’ => false,
‘rewrite’ => array(‘slug’ => ‘event’, ‘with_front’ => false ),
‘supports’ => $supports,
‘menu_position’ => 20,
‘menu_icon’ => ”,
‘taxonomies’ => $taxonomies
add_action(‘init’, ‘register_event_posttype’);

Step 2 –


Now we add some css in the admin head, But first go to and find the icon from the list that you want to use and click on the icon then click on “Copy CSS” in header, it will provide the code like content: "\f116";. Now add the following code into your theme’s functions.php.

function qt_add_menu_icons_styles(){

#adminmenu .menu-icon-events div.wp-menu-image:before {
content: ‘\f145’;

add_action( ‘admin_head’, ‘qt_add_menu_icons_styles’ );


And you are Done!!

Disable admin bar from WordPress Site

WordPress by default provide admin bar at the top of the page for logged in users.

By using wordpress filtering and hook system, we can disable the admin bar from wordpress site for logged in user. Here is the snippet which will disable admin bar from wordpress site.


add_filter(‘show_admin_bar’, ‘__return_false’);


Add this filter into your theme’s funtions.php file