How to Launch a Self Hosted WordPress Blog in Few Minutes

If you want to start new business or you want to start blog for fun it doesn’t matter I believe that currently at the end of 2013 self hosted WordPress site is the best option for you. WordPress give you many extending options, it is open source platform and you can find thousands of free templates and plugin extensions.

Lunching a Self Hosted WordPress Site

Video is coming soon [Youtube channel is temporary unavailable]
Since in 2008 I discovered Namecheap domain register. At that time they were offering domains only, nowadays they are selling both domains and hosting for them. There are various hosting options, but in my video I will use Namecheap service as I like their services, especially their 24×7 support witch is one of the best I’ve ever seen.

namecheap screenshot

Steps for launching your own blog

In next four steps I will try to describe you in simple lines what you have to do to setup self hosted WordPress blog in matter of minutes.

Get a host

Web host is home of your websites. You own it but you have to pay fee for hosting. I suggest using Namecheap hosting as they offer $3.48/month offer for annual payment.

Register a domain

You can order your domain on many domain registers but I suggest you registering domain through your hosting company. This way you keep everything streamlined. In case that you’ve already registered desired domain with another service you just need to host it on Namecheap servers or you can transfer your domain to Namecheap for cheap as $4.99 one time payment.

Installing WordPress and SQL setup

This is very easy and strait forward process but for a beginners this could be nightmare. I can’t suggest you using of automatic install tools that are offered by hosting company as personally I don’t like them.I prefer installing WordPress manually. For manual installation you have to go through and download latest version of the WordPress then upload it into server. (Note that there are free blog sign up available at or, check the advantages of self hosting blog). Wile uploading will take some time you have to create SQL database and user. Of-course you have to attach user to the database.

Log in and start blogging

Latest thing to do is to finish installation trough wizard page and login, you are ready to start blogging (Check our WordPress Tips for Beginners).

Make your blog authoritative

If you are serious blogger and want to success in online business you have to daily work on your blog authority. This is serious and must do process if you wish to make money blogging check our tips and tricks to get your blog authoritative.

Install error: preg_replace(): Compilation failed: shortcodes.php on line 309

Hi friends, I’m back on WPError again. I’m here to share a new experience on example I’ve faced today. I was hired to move WordPress WooCommerce web-shop based on Bazar WordPress template from one to another domain. On the first sight project looks quite simple we could say “ABC” job but several issues appear.

I did successful SQL and FTP backup and restored both on the new server, did required SQL changes trough the PhpMyAdmin and tried to run the site. Then received this error for the first time in my six years of experience.

Install error: Warning: preg_replace(): Compilation failed: unknown option bit(s) set at offset 0 in /home/public_html/wp-includes/shortcodes.php on line 309

warrning shortcodes 309

Website is broken, revolution slider didn’t work (WordPress was unable recognize and call slider name), none of custom template shortcodes were working and there was many more smaller issues and errors.

At first I tried with various things with plugins and setting but at the end I realized it could be PHP error. So I decided to try with downgrading PHP from 5.4 to PHP 5.3 version. New server was on Godaddy witch under the Cpanel have an option for Software/Services – Select PHP version.

software and services

As soon as I switched PHP to older 5.3 version all site errors and issues are gone.

Spiro is back: Summertime Sadness

After few summer months I’m back, online and working on WPError as well as freelancer again. Meanwhile I was without, PHP programmer! Can u imagine PHP programmer without INTERNET CONNECTION… Big thanks to T-com Croatia, my internet service provider.

Anyway I used my time well, spend it with my wife and kids. I’m building some apartments and first one is almost done. Hehe!

Remove delete button on some categories

Remove delete button on some categoriesThere is another interesting snippet function add-on for your WordPress sites. Currently there is no way to disable or remove/delete button on WordPress Categories or other lists, so for example, your “MAD” or “DRUNK” Editor can suddenly remove categories.

That’s why I come to idea that this snippet should be interesting and thanks to S_HA_DUM, moderator of Stackexchange, there was already available snippet for this.

For those fields WordPress uses WP_List_Table class and some other extension, in this case WP_Terms_List_Table class and that class contains a filter called {$taxonomy}_row_actions.

$actions = apply_filters( “{$taxonomy}_row_actions”, $actions, $tag );

Remove “delete” button on some categories

* Snippet Name: Remove delete button on some categories
* Snippet URL:

function($actions, $tag) {
$no_del = array(7,13);
if (in_array($tag->term_id,$no_del)) {
return $actions;

Even with this tutorial I believe your WordPress categories are not 100% secured as there is bulk edit >> delete option still available and categories selected trough ID’s from earlier snippet are not protected.

This is why I’m thinking to write another snippet for bulk remove control!

Improve WordPress default image quality

It’s well known that a picture says more than 1000 words so there are many webmasters or site owners who are using thousands of images at the site. Still there are people like artists or photographers who want to show off their work and use many images. Of-course that they want to show them in great quality, but WordPress by default cut the quality to 90%. The whole idea of compressing images is here to help your pages load faster and keep file sizes smaller. Anyway if you still miss that extra 10% this is topic for you. Let me explain you a thing!

First of all there are two elementary image extensions we use daily and these are JPG and PNG. Differences are enormous and let me show you why.The most common image extensions used online is JPG, mostly because they can apply heavy layers of compression and in process page will load faster. That’s great for your page visitors and also for SEO. But in process of compression you lose some of the picture quality which could be issue for you. PNG or (Portable Network Graphics) extension have much larger files and of-course have better quality, but problem is that your page will load a little bit slower.

No matter how much time you duplicate save and re-upload PNG’s with your WordPress images will keep quality witch is opposite to JPG. PNG’s also support palette-based images with palettes of 24-bit RGB or 32-bit RGBA colors, images with or without alpha channel and full-color non-palette-based RGB images…

Why and when you should improve image quality?

WordPress image quality
There are three images the one of the left 100% quality, middle one 90% and right at 80%.

When you upload image in WordPress post it’s clearly visible that quality of image is downgraded and we all wonder why is that happening. Simply WordPress create a thumbnail so you can use it again in later.

If you are an artist or photographer or for any other reason you wish to improve your image quality here is a snippet witch you can add bellow to your theme’s functions.php or you can simply made it trough free plugin.

You are right, this snippet is allowing you to control quality of uploaded images or to save bandwidth if you wish. You can change the JPEG compression-level of images simply by editing return (int)100; part of the function.

Improve WordPress default image quality

* Snippet Name: Improve WordPress default image quality
* Snippet URL:
function wpe_jpeg_quality_callback($arg)
return (int)100;// change 100 to whatever you prefer!

add_filter(‘jpeg_quality’, ‘wpe_jpeg_quality_callback’);

Make WordPress subcategories to use parent category template

subcategories templateWell today I’m going to bring you new snippet. For example, let’s say you are using the posts for various purposes like questions, pools, articles and reviews. To sort it out you will need different categories. Of-course now you need to design different category layout. This is done using the slug preference, like: category-questions.php, category-pools.php, category-reviews.php in your template folder etc.

The whole idea is great and it will work, but things goes wrong when you add subcategories to any of parent (main) categories like on our example questions, pools, reviews… To understand it we need to know WordPress hierarchy

The category/archive template hierarchy in WordPress.


To understand to this “issue” even that is not, we have to look at default get_category_template() function witch is in WordPress since 1.5 update.

Default WordPress GET category template function

function get_category_template() {
$category = get_queried_object();

$templates = array();

if ( ! empty( $category->slug ) ) {
$templates[] = "category-{$category->slug}.php";
$templates[] = "category-{$category->term_id}.php";
$templates[] = ‘category.php';

return get_query_template( ‘category’, $templates );

If we watch closer to the get_category_template() function we can’t miss that it doesn’t look up hierarchy at all so the new function should do exactly that.

What this means? If there is a category named reviews, and the ID 13, then category archive will first look for the file category-reviews.php , then for the file category-13.php. If those php files are missing it will search for category.php. For example it also doesn’t exist, it will continue to archive.php and if there are lack of archive.php goes for the index.php to display the category content.

With this logic it’s obvious that the subcategory of category reviews, actually hosting ( won’t load category-reviews.php.

So this snippet is telling WordPress to recognize if there are parent’s category template (category-reviews.php) available to use it as child’s template too.

Make subcategories to use parent category template

/****** Make subcategories to use parent category template ******/
* Snippet Name: Make WordPress subcategories to use parent category template
* Snippet URL:
function wpe_subcategory_template() {
$category = get_queried_object();

$parent_id = $category->category_parent;

$templates = array();

if ( $parent_id == 0 ) {
// Use default values from get_category_template()
$templates[] = "category-{$category->slug}.php";
$templates[] = "category-{$category->term_id}.php";
$templates[] = ‘category.php';
} else {
// Create replacement $templates array
$parent = get_category( $parent_id );

// Current first
$templates[] = "category-{$category->slug}.php";
$templates[] = "category-{$category->term_id}.php";

// Parent second
$templates[] = "category-{$parent->slug}.php";
$templates[] = "category-{$parent->term_id}.php";
$templates[] = ‘category.php';
return locate_template( $templates );

add_filter( ‘category_template’, ‘wpe_subcategory_template’ );

Add Thumbnails in Manage Posts/Pages and Other Post Types

Hi there, here we go again! For today I’ve prepared you this simple ready to copy functions to display to the Manage/Edit Post and Pages and my custom taxonomy Downloads a new column with the thumbnail preview.
Thumbnails in Manage Posts

This snippet will first search for thumbnail and it’s id, but if fail then look for attachment used in the image there are no thumbnails on the posts to call a image[0], or the first image in the post, page or download type.

The default thumb size is 55px x 55px but you can easy change it on this snippet code. Simply you just have to edit $width and $height values. The same worth for custom post type selection, just edit this part of a code add_theme_support(‘post-thumbnails’, array( ‘post‘, ‘page‘, ‘download‘ ) );.

Add Thumbnails in Manage Posts/Pages

/****** Add Thumbnails in Manage Posts/Pages List ******/
* Snippet Name: Add Thumbnails in Manage Posts/Pages and Other Post Types
* Snippet URL:
if ( !function_exists (‘AddThumbColumn’) && function_exists (‘add_theme_support’) ) {

// for post and page
add_theme_support (‘post-thumbnails’, array( ‘post’, ‘page’ ) );

function AddThumbColumn ($cols) {

$cols[‘thumbnail’] = __(‘Thumbnail’);

return $cols;

function AddThumbValue ($column_name, $post_id) {

$width = (int) 35;
$height = (int) 35;

if ( ‘thumbnail’ == $column_name ) {
// thumbnail of WP 2.9
$thumbnail_id = get_post_meta( $post_id, ‘_thumbnail_id’, true );
// image from gallery
$attachments = get_children( array(‘post_parent’ => $post_id, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’) );
if ($thumbnail_id)
$thumb = wp_get_attachment_image( $thumbnail_id, array($width, $height), true );
elseif ($attachments) {
foreach ( $attachments as $attachment_id => $attachment ) {
$thumb = wp_get_attachment_image( $attachment_id, array($width, $height), true );
if ( isset($thumb) && $thumb ) {
echo $thumb;
} else {
echo __(‘None’);

// for posts
add_filter( ‘manage_posts_columns’, ‘AddThumbColumn’ );
add_action( ‘manage_posts_custom_column’, ‘AddThumbValue’, 10, 2 );

// for pages
add_filter( ‘manage_pages_columns’, ‘AddThumbColumn’ );
add_action( ‘manage_pages_custom_column’, ‘AddThumbValue’, 10, 2 );

Add an Awesome Custom Search Box Widget to WordPress

wperror-custom-search-widget Do you mind how to create this beautiful custom search box as example on the left. Here we go with complete tutorial with both PHP, HTML and CSS part on this great looking Custom Search WordPress Widget.

Custom Search Widget for WordPress

* Snippet Name: Add an Awesome Custom Search Box Widget to WordPress
* Snippet URL:

// Creating the widget
class wpe_search extends WP_Widget {

function __construct() {
// Base ID of your widget

// Widget name will appear in UI
__(‘WPError Custom Search’, ‘wpe_search_domain’),

// Widget description
array( ‘description’ => __( ‘Search widget based on WPError Tutorial’, ‘wpe_search_domain’ ), )

// Creating widget front-end
// This is where the action happens
public function widget( $args, $instance ) {
$title = apply_filters( ‘widget_title’, $instance[‘title’] ); ?>
<div class="wpe-search-block">
<h4><?php if (! empty( $title )) { echo $title; } else { echo ‘Search">'; } ?></h4>
<div class="wpe-main-block">
<form role="search" method="get" class="search-form" action="">
<div class="wpe-content-block"><input placeholder="Search…" class="form-control" name="s" title="Search for:" type="search"></div>
<div class="wpe-action-block"><input value="Search" class="search btn wpe-search" type="submit"></div>
<?php }
// Widget Backend
public function form( $instance ) {
if ( isset( $instance[ ‘title’ ] ) ) {
$title = $instance[ ‘title’ ];
else {
$title = __( ‘New title’, ‘wpe_search_domain’ );
// Widget admin form
<label for="<?php echo $this->get_field_id( ‘title’ ); ?>"><?php _e( ‘Title:’ ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( ‘title’ ); ?>" name="<?php echo $this->get_field_name( ‘title’ ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />

// Updating widget replacing old instances with new
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance[‘title’] = ( ! empty( $new_instance[‘title’] ) ) ? strip_tags( $new_instance[‘title’] ) : ”;
return $instance;
} // Class wpe_search ends here

// Register and load the widget
function wpe_load_widget() {
register_widget( ‘wpe_search’ );
add_action( ‘widgets_init’, ‘wpe_load_widget’ );

Add custom post types to archives page

CPT ArchivesAfter we have added custom post types snippet into our functions.php we expect that our new articles under the custom post type to appear on archive pages, but they will not. It’s very logical from the developers side, WordPress maintain that sorting archives is for normal post types “posts”, and adding custom post types into categories and post_tags requires some custom code.

So, if you’d like your custom post types to show up in archive listings for your site’s standard tags and categories you can add the following code to your functions.php file:

Add custom post types to archives

* Snippet Name: Add custom post types to archives page
* Snippet URL:

function add_custom_types_to_tax( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars[‘suppress_filters’] ) ) {

// Get all your post types
$post_types = get_post_types();

$query->set( ‘post_type’, $post_types );
return $query;
add_filter( ‘pre_get_posts’, ‘add_custom_types_to_tax’ );
Still if you wish to display only specific custom post types into archive pages of tags and categories you can replace the line $post_types = get_post_types(); with $post_types = array( ‘post’, ‘your_custom_type’ );.

Create a Custom Post Type Download

Custom Post Type Download

Nowadays when WordPress become most used CMS, users are searching for various improvements for their sites. WordPress have ability to add custom post types and taxonomies easily with some snippet code in your functions.php file, or even easier trough the various plugins witch brings you this and similar options like custom taxonomies, custom meta boxes, fields etc. All those snippets/add-ons can quickly turn your WordPress site into well-featured CMS.

One of the easiest ways to add custom post type is trough the free WordPress plugin Custom Post Type Maker. Personally I preffer adding them with snippet code so I brings you simple snippet code that is ready to paste into functions.php file.

Custom Post Type Snippet

* Snippet Name: Create a Custom Post Type "Download"
* Snippet URL:

add_action( ‘init’, ‘register_cpt_download’ );
function register_cpt_download() {
$labels = array(
‘name’ => _x( ‘Downloads’, ‘download’ ),
‘singular_name’ => _x( ‘Download’, ‘download’ ),
‘add_new’ => _x( ‘Add New’, ‘download’ ),
‘add_new_item’ => _x( ‘Add New Download’, ‘download’ ),
‘edit_item’ => _x( ‘Edit Download’, ‘download’ ),
‘new_item’ => _x( ‘New Download’, ‘download’ ),
‘view_item’ => _x( ‘View Download’, ‘download’ ),
‘search_items’ => _x( ‘Search Downloads’, ‘download’ ),
‘not_found’ => _x( ‘No downloads found’, ‘download’ ),
‘not_found_in_trash’ => _x( ‘No downloads found in Trash’, ‘download’ ),
‘parent_item_colon’ => _x( ‘Parent Download:’, ‘download’ ),
‘menu_name’ => _x( ‘Downloads’, ‘download’ ),
$args = array(
‘labels’ => $labels,
‘hierarchical’ => true,
‘supports’ => array( ‘title’, ‘editor’, ‘excerpt’, ‘author’, ‘thumbnail’, ‘trackbacks’, ‘custom-fields’, ‘comments’, ‘revisions’, ‘page-attributes’ ),
‘taxonomies’ => array( ‘category’, ‘post_tag’ ),
‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘menu_position’ => 5,
‘menu_icon’ => ”,
‘show_in_nav_menus’ => true,
‘publicly_queryable’ => true,
‘exclude_from_search’ => false,
‘has_archive’ => true,
‘query_var’ => true,
‘can_export’ => true,
‘rewrite’ => true,
‘capability_type’ => ‘post’
register_post_type( ‘download’, $args );

The known issue when the custom post types are created trough the snippet is that WordPress does not automatically take your custom post types and add them to the archive pages for existing taxonomies like categories or post_tags. Because of that we have prepared you another snippet for adding custom post types to archives page with snippet too.