What Things To Keep In Mind When Choosing a Theme

When it comes to choosing a theme for their websites, most newcomers are overwhelmed. There are thousands of themes available, both free and paid. Each theme appears to be superior to the others. How do you pick the best WordPress theme?

As a result, I’ve compiled a list of 7 Things to Consider When Choosing a Theme.

1. DO choose a theme that supports the latest version of WordPress:

My #1 recommendation has nothing to do with layout or fonts—all it’s about is usefulness and security. For three very good reasons, the theme you pick must be compatible with the most recent version of WordPress:

  • Your WordPress site’s functionality may not work as you want it to if your theme isn’t fully compatible with the current WP version.
  • Your site’s functionality will suffer if the plugins you use require the most recent version of WordPress and you are unable to upgrade because of your theme.
  • If you choose a theme that does not support newer versions of WordPress, you may decide not to upgrade WordPress, which can result in security holes, data breaches, site defacement, and other problems.
2. Strive for Simplicity:

Many WordPress themes have a variety of colors, complex layouts, spectacular animations, and so on. You may require those items on occasion, but in most circumstances, you will not require all of them. Look for a theme with a design layout that will assist you to achieve your aim. It must look excellent without sacrificing usefulness or simplicity.

 Make certain that the presentation style of the theme is not excessively complex. The goal of web design is to help users discover the information they need while also supporting site owners in achieving their objectives.

3. Responsive is Not Optional Anymore:

Responsive themes automatically alter their layout to fit multiple screen sizes and devices.

Mobile and other handheld devices produce a large amount of online traffic. Depending on the content of your website, this figure might be as high as 50% of the total number of visitors.

Most WordPress themes are already responsive by default. But there are still sellers who are selling fixed-width layouts that are not mobile-friendly at all. Make sure that the theme you are choosing for your website is mobile-friendly.

4. Supported Plugins:

If you are looking for a WordPress theme, you should also consider its compatibility with plugins because WordPress plugins are what give WordPress its true power. You can accomplish anything with your WordPress site thanks to these plugins.

5. Page Builders:

Page builders are WordPress plugins that let you construct page layouts with a drag-and-drop user interface.

 Many premium WordPress themes have pre-installed page builders. Some of these page builders are only available to the theme creator.

Using a page builder like this to construct landing pages might result in a lot of needless code. If you ever change the theme, those pages will need a lot of cleaning up.

You should select themes that have one of the most popular page builder plugins. You may also buy these page builders individually and use them with different themes.

6. SEO Friendliness:

Your theme is critical to the SEO friendliness of your site. A good-looking theme might also produce poorly coded HTML, which can harm your site’s search engine performance.

It may be tough for beginners to evaluate the source code of a theme on their own. Therefore, many premium theme developers will tell you that their sites are SEO-friendly.

7. Ratings and Reviews:

The ratings and reviews left by users are other good measures of a theme’s quality. Customer reviews will appear if the theme is offered on a third-party marketplace.

The rating area for free themes is located directly below the download button. It will display the number of user reviews and ratings. If you click on 5 stars, it will display all the reviewers that rated the theme 5 stars.

Mark parent category menu active on single custom post view in WordPress

Recently I developed a theme for one of my clients and I had to highlight the menu item of the parent category in the main menu when one of its associated single custom posts was viewed. For that, I had to add an action in my functions.php file for nav_menu_css_class. It returns the ‘active’ class, which WordPress adds to the parent category menu item in the main menu. You can see the code at Gist here or below.

<?php

add_action('nav_menu_css_class', 'add_current_nav_class', 10, 2 );

function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;

// Getting the post type of the current post
$current_post_type = get_post_type_object(get_post_type($post->ID));
$current_post_type_slug = $current_post_type->rewrite['slug'];

// Getting the URL of the menu item
$menu_slug = strtolower(trim($item->url));

// If the menu item URL contains the current post types slug add the current-menu-item class
if (strpos($menu_slug,$current_post_type_slug) !== false) {
$classes[] = 'active';
}

// Return the corrected set of classes to be added to the menu item
return $classes;
}
?>

Adding above code in you functions.php file will do the trick.

Click here to read more on WordPress.

Displaying Multiline Title in WordPress

In WordPress when the title is written it is usually displayed in a single line on front-end until it is too long to display in one line. But if you want to write the title in multiline and want to line break the title after a certain word how can you do that?

It is pretty simple. Since we know the fact that when the title is displayed it is a heading which is displayed using an HTML tag of course. So, taking benefit of HTML we can just insert an HTML line break element <br/> just after the word in our title where we want the line break. Like this:

“This is my title <br/> with my own line break”

WordPress Multiline Title

This will be displayed in two lines when you publish the post.

Read more about WordPress.

Different color for each menu item in WordPress

In a recent project, I got a requirement that each menu item should be highlighted in a different color when visited. The menu items and their required active colors were:

  • Home – Green
  • Portfolio – Blue
  • Team – Yellow
  • Contact – Red

These colors were to be applied only when that page is being visited otherwise color of the menu item should be the default black color.

So, if a user is visiting the home page then the menu item should something like this

home_menu.png

And if the user is visiting the Portfolio page then the menu should be something like this

portoflio_menu.png

Considering that this was a WordPress theme project where we were using Understrap as a base theme which is based on Twitter Bootstrap. So, when user visits, for example, a home page WordPress will attach a .active CSS class to it. Taking advantage of that we added different classes for each menu item and then used the following rule to make menu item colors different:

.navbar-nav > .home.active > a {
    color: green!important;
}
.navbar-nav > .portfolio.active > a {
    color: blue!important;
}
.navbar-nav > .team.active > a {
    color: yellow!important;
}
.navbar-nav > .connect.active > a {
    color: red!important;
}

CSS Class Chaining Method

We utilized the class chaining method here. If you note that .home.active classes are chained together without space and which means it will select an element with both these classes.
That did the trick and all menu items were in a different color.

Rollover image – Change image on hover/mouse over

Often when designing websites static or dynamic, PHP or ASP.Net, Laravel or WordPress, you have to design in a way that if the user hovers an image it gets changed and an alternate image is displayed. This can be easily achieved via simple HTML events. Here is the trick:

<img src="FIRST IMAGE URL GOES HERE"
onmouseover="this.src='SECOND IMAGE URL GOES HERE'"
onmouseout="this.src='FIRST IMAGE URL GOES HERE - AGAIN'" />

It is simple as that.

Click here to read more tips.

How to start E-commerce business in Pakistan? Part-1

It is very impressive how Pakistan is progressing in the field of IT, telecom and broadband penetration. Pakistan’s e-commerce market is growing tremendously and presents great opportunities for everyone.

Pakistan’s broadband penetration has grown to over 40 million (38 million are on 3G/4G), up from just 2 million in April 2014. With more than 45 million smartphones in the market, Pakistan is on track to become one of the largest internet population in the world.

Foreign players and giants like Alibaba group are planning to enter Pakistan’s huge potential market. It is still a rising market and there is a massive potential for small businesses alike.

Why e-commerce?

E-commerce has several advantages over the traditional physical business. A few major benefits are:

  • Low investment as compared to a physical business
  • Can target a wider audience
  • You can start business immediately

Physical vs Online

For a physical business initial investment is huge. You need a place, a shop or an office. If you are going to buy it will cost you millions. If you go for the rental, you will still have to pay a considerable amount in advance and your monthly operational cost will be high. Then there are other one-time costs involved like furniture, lighting, and other stuff. You have to spend a big amount even before you start selling.

As compared to starting an e-commerce business you just need to buy a domain and hosting or go for platforms like Shopify or BigCommerce. You can get your site developed at very cheap rates from freelancers or if you are a power user then you can set up your own site that will cost you free. Few ready-made solutions that are available are:

  • WordPress/WooCommerce
  • OpenCart
  • Prestashop
  • Magento

There are even lot of other solutions available that you can search and try. If you do this on your own it will cost you free.

Setup and Operations cost is low

The next step would be to enter your inventory in your e-commerce store. That shouldn’t take more time. It could even be done sooner than setting up a physical shop. Due to this, you can start an online business immediately as compared to a physical store.

Target wider audience

If you have a physical store then you can target only the people in your area or city depending on where you are located. If you are a small businessman with a shop in your locality, your customers could only be from your nearby areas. If you have a shop in a bigger mall or market then your audience would be wider. But if you open an online e-commerce store you can target not only your city but your country, or you can even go international, resulting in huge potential for great revenue.

This is just the tip of the iceberg. But remember you must have some business sense since an online store is also a business. Without business strategy and marketing since you won’t be successful.

In the coming episodes, we’ll talk more about setting up an e-commerce store, the role of technology, business and marketing tips, how to grow your online business and much more.

If you feel this is a good read and want to read more about a topic you are interested in then feel free to leave me feedback and I’ll add it to my upcoming topics list.

Override parent shortcodes in your WordPress Child Theme

Overriding shortcode defined in WordPress parent theme is pretty easy.

Just use a after_theme_setup section in functions.php of the child theme;

example:

add_action( 'after_setup_theme', 'my_child_theme_setup' );

function my_child_theme_setup() {
   remove_shortcode( 'your_shortcode' );
   add_shortcode( 'your_shortcode', 'my_shortcode_function' );
}

function my_shortcode_function( $atts, $content = null ) {
    extract(shortcode_atts(array(
    ), $atts));
    $out = 'content">'.do_shortcode($content).'</div>';
    return $out;
}

Click here to read more about WordPress.