WordPress is the most popular CMS (Content Management System) in the world created in PHP and Mysql or MariaDB. More then 26 million of websites are done using WordPress which makes us believe that is a great cms to use for our website. But what makes WordPress so widely used and should you use it on every type of website? Why some companies decide to not use it?

Why is WordPress used so much?

The top reason why WordPress is so popular is because its very easy to be implemented. It is straight forward to implement a new template or even to create a new template from scratch.

What makes it even easier are plugins. WordPress has thousands of plugins created by developers all around the world which makes our lives much easier. By using some plugins you can create simple or intermediate websites even if you don’t know to code. A great plugin worth mentioning is Elementor which is a website builder plugin and gives you the power to create your website without writing a line of code. Another great plugin for e-commerce websites is WooCommerce.

A great plugin is YOAST which is the most used plugin from SEO manages with awesome SEO features.

Should you use WordPress for every website?

WordPress is great for small and intermediate websites but depending on your needs you might not want to use it for high traffic websites. Even tho many developers try to use it for big website but WordPress is differently not the best solution for high traffic website.

For advanced websites you usually need to add very complicated features which would be difficult to implement with WordPress. Some companies tried to change WordPress core queries to increase performance and it worked. But after a while it got impossible to maintain and if you change the core of the app you cannot upgrade to new releases as well.

Let’s see some tricks

1. Create a template from scratch

Use underscores.me to make create a template from scratch. Underscores is an open-source template with all the basic things out of the box which gives you the full structure ready to start and develop your own template.

2. Create a new page custom template

Sometimes as a developer, you need to create custom designs for specific pages. In cases like this, you cannot reuse the same HTML template for all. What you usually do is go into your theme path and create a folder called templates. Within the folder create a PHP file for your template and naming whatever you want. To be recognized as a template file you need to give the template a name. Put the following content on you php file:



* Template Name: About us


get_header(); ?>


<?php get_footer(); ?>

This will look something like this:

The final step is creating the actual page and connecting the page with the template. Login into your wordpress admin panel and create a page by going to Pages -> Add New. In the right panel go to Pages Attributes and from the Template drop-down choose the template you just created.

3. Get feature image of the page or post type

One of the most common things you would use in a custom page template is getting the feature image of the page here is how you do it:

<?php while ( have_posts() ) : the_post(); ?>

if (has_post_thumbnail()) {

  echo the_post_thumbnail(‘medium-thumb’);


<?php endwhile; ?>

This code will print the html with the featured image but if you want to get only the url you can do something like this:

  while ( have_posts() ) : the_post() {
  if (has_post_thumbnail($post->ID)) {
      $imageArr = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘single-post-thumbnail’ );

$imageUrl = $imageArr[0];


4. Post Types in WordPress

On complex websites many times it is impossible to rely only on build in WorPress features. Creating more complex data types is necessary. Let’t take a simple example. Let’s say you need to have a page with opening job positions. So you create a custom post type called jobs where you insert all job posts. A popular plugin that helps creating post types without any line of code on the admin site is Custom Post Type UI.

After creating the post type and all job openings on the WordPress admin page using them into your template is easy. You can easily query them by using WordPress build-in methods:

//Define your custom post type name in the arguments

$args = array(‘post_type’ => ‘jobs’,’order’=>’ASC’);

//Define the loop based on arguments

$loop = new WP_Query($args);

//Display the contents

while ( $loop->have_posts() ) : $loop->the_post() {



5. WordPress custom fields

Another important you will need while creating custom templates are custom fields. A famous plugin to help you create custom fields is the so-called Advanced Custom Fields. The plugin will help you create custom fields on the backend. But you need to get values of the custom fields somehow on the code right? You do that by using the following method:

$myCustomField = get_field(‘my_custom_field’);

6. Page title, content and excerpt

Get current page or post title:

<?php the_title(); ?>

Get current page or post content:

<?php the_content(); ?>

Get current page or post excerpt:

<?php the_excerpt(); ?>

7. Search form

To print WordPress default search form on the template is very easy. The search form is printed only by calling a single method:


In most of the themes, there is a specific file that displays the result of the search. If you are using the underscore template find the file search.php and edit the HTML on your needs.

By default, the search form will do a search in all post types on created. To edit the default behavior of the search form is easy as well. Let’s say instead of searching in all post types we want to search only the Job post type. Go to your function.php file and add the following code:

function searchFilter($query) {

    if ($query->is_search) {

        $query->set(‘post_type’, ‘jobs’);


    return $query;



8. Custom page content

In some rare cases, you might need to get the content of another page. You can query the content of the other page easily by using the page slug. Let’s say we need to take the content of the About Us page.

$query = new WP_Query(‘pagename=about_us’);

if ($query->have_posts()) {

 while ($query->have_posts()) {





/* Restore original Post Data */


9. Query with no limit

Sometimes you may have noticed that when you do a WordPress query not all the posts appear. This is because there is a default limit on the query which is configured on Settings -> Reading on the admin panel. To do a query without limit use the posts_per_page argument with a -1 value.

$args = [‘posts_per_page’ => -1, ‘post_type’ => ‘partners’];

$query = new WP_Query($args);

if ($query->have_posts()) {

 while ($query->have_posts()) {





/* Restore original Post Data */


10. Taxonomies

Taxonomies are used on every website. Usually you categorize posts of your website with categories and tags. WordPress has simple function to get the categories and tags. To get all the terms use

$taxonomies = get_terms(‘category_slug’);

And to get terms for the current post use:

 $terms = get_the_terms($post->ID, ‘category_slug’);