How to install and configure Q-Translate WordPress plugin

Despite being having many other translators, I like Q-Translate for it easy to use and flexible feature, and yes it’s completely free rather than other. Here, I’m going to start a series of posts that would let you know everything about Q-Translate plugin system – installation, configuration and integration with any theme that supports Multilingual / Translation.

Let’s dive into the first lesson…

Download and install the plugin as it does like many other plugins. After activating the plugin, you must find these notifications – starter guide and survey. Just ignore them clicking the dismissal buttons like the screenshot below –

Activation notices of Q-Translate plugin

Now go to Settings > Languages.

Languages settings

Now you would see the two default languages English and Deutsch in the General tab.

Q-Translate Language in General tab

The most important settings in the General tab is URL Modification Mode but ignore it now, I will discuss this in the other article for sure.

Now go to the Advance tab, here you could find Post Types, now choose the option you want to show your translation option there. By default, all options are selected. But if you want, you could unselect any of one/two you need. Here I’m selection only Posts, Pages. Remember that, if you have any other custom post types, you could find them here also.

Q-Translate supported post_type

So, you can now visit your pages, posts editor and see the settings for your desired language is come like the screenshot below –

Q-Translate language switcher buttons

Language switcher button for your desired languages will be there, so you can add/enable more languages to see more language buttons here and I’ll be sharing the way you can add another language to the next article.

Let me know if you faced any problem installing that plugin so that I could assist you.

And if this article helps you settings up the plugin, please let’s share your thought so that I can get encouragement for writing more helpful article. 🙂

How to create multiple headers and footers file and fetch their data in WordPress

In WordPress, there are plenty of things we still don’t know. One of them is creating “multiple headers and footers” files and fetch their data.

Sounds new to you? Maybe!

Before I’m going to clear the thing, I assume you have a solid understanding of WordPress template system with header.php, footer.php and get_header(), get_footer() templates tags. Without knowing these, you’d not understand what I’m talking here.

Now, let’s describe the matter.

Every WordPress developer (theme developer actually) have to work on a lot of things in header and footer files to make the theme perfect. One of the main benefits of creating multiple headers and footers file is, the design looks unique for each page or a certain page you’d like to select in.

Suppose, your theme has a header (header.php) and a footer (footer.php) file –

header.php has 3 columns, containing a logo, menus, and social icons. footer.php has 2 columns, containing various links, text and subscription form for all the pages in your website. Now you want, except homepage, all other pages will have a design like so –

In the header, 2 columns with having only logo and social icon. And in the footer, 1 column with having copyright text.

So, you’ve to style a different header/footer file for your custom header/footer that will be added on the other pages except for home page as I said. You designed and named the new header/footer file to header-column-2.php or footer-full-width.php

Now, how could you call them to your theme? That, where you found WordPress’s beauty! 🙂

Just calling the normal get_header(); will fetch the data from header.php file. But if you call the get_header() with passing an argument like: get_header(‘column-2’); or for footer, get_footer(‘full-width’);. That will fetch the data from your custom made header (header-column-2.php) or footer (footer-full-width.php) file.

The thing to remember that, you must keep the prefix “header-“ and “footer-” before your custom header and footer file, and when you call them, call them without “header-“ or “footer-”. Otherwise, it won’t work!

So, if you’ve a file named new-style.php for header, name it to header-new-style.php and call it like get_header(‘new-style’);. So that, WordPress will automatically understand you’re asking data from the header-new-style.php file.

Sounds easy, huh?

Let’s share this article so that more peoples could know it.

How to rename WordPress default database table prefix

Defining custom table prefix during WordPress installation is very important. Because we know (those who’re installed WordPress at least one time by his own) by default WordPress give us a table prefix called wp_. See the screenshot below –

WordPress Default Database Prefix

As a general WordPress user, WordPress developer or a hacker is very familiar on it. That’s not a problem though! But what if, you left your database table prefix as default by anyway and “Mr. Hacker” find that in your database, ha? He left your site as is, as you did also, right? 😛 Hey! Don’t be so silly!

So, if you did that mistakenly or anyway and after you’ve done all the setup, settings completed there is no way to roll back the installation rather than deleting the entire site and install it again. But you could rename your default table prefix using a simple MySQL query.

So, here I’m going to show you the simplest (not much) method of how you could rename your WordPress default table prefix manually. It could be in localhost or in remote server but the method is same. Let’s dig in –

1. Open your WordPress database where you’ve already install your WordPress website and check the default prefix exists or not, see the screenshot below –

WordPress Default Database Prefix In  DB Table

2. If yes, then – click on SQL tab. See the screenshot below –

SQL Tab Above The DB Table List

3. After couple of seconds SQL tab will give you a nice window where you could write any SQL query. See the screenshot below –

MySQL Window

4. But don’t try to be over smart with SQL or your whole site will be mess-up. Now it’s time to write our appropriate MySQL query to change the default table prefix to our own. Assuming that my new prefix will be new_ and it will replace the default wp_. That’s the main point of this article.

5. We know by default WordPress install 11 tables with our given/default prefix name. If you don’t know yet and wants to know which tables are install during installation, please check back step 2 in the above.

6. Now the SQL query matter – we’re going to use MySQL RENAME TABLE… To… query to perform our job. The step is very simple. Simply write the code in the SQL tab and hit on Go button as I’m writing below to accomplish my job –

RENAME TABLE wp_commentmeta To new_commentmeta;

7. Now check your table listed in the database from the left side panel. The prefix has been changed. But other tables are unchanged with their default prefix. See the screenshot below –

Changing Mysql Table Prefix Using Rename Table SQL Query

8. But again think about that, we’ve now 10 tables remaining that needs the prefix to be changed. What do you think? How should we accomplish this at once? Again the simple way, we should now perform the same query but for 10 tables in 10 individual lines with their old and new prefix and name. Let’s write –

Rename TABLE wp_comments TO new_comments;
Rename TABLE wp_links TO new_links;
Rename TABLE wp_options TO new_options;
Rename TABLE wp_postmeta TO new_postmeta;
Rename TABLE wp_posts TO new_posts;
Rename TABLE wp_terms TO new_terms;
Rename TABLE wp_term_relationships TO new_term_relationships;
Rename TABLE wp_term_taxonomy TO new_term_taxonomy;
Rename TABLE wp_usermeta TO new_usermeta;
Rename TABLE wp_users TO new_users;

Now hit Go again. You can now see the left side panel and all the tables name has been changed successfully. Easy ha?

wordpress-all-table-prefix-changed

9. But this is not ended here, some more steps remain on the fly.

10. Most importantly you should now change you table prefix in the wp-config.php file, in line 66. See the screenshot below –

Changing Table Prefix In Config File

Now, refresh your browser and see your website working or not. If not then you should follow some steps to get rid of the problem. Check out –

a) Go to your new_options table and find the ‘wp_user_role’ option in ‘options_name’ column. Just double click on it and rename by ‘new_user_role’ or whatever your choose earlier.
b) Go to your new_usermeta table and find the options wp_capabilities, wp_user_level in ‘meta_key’ column and change their prefix as well followed by the above step. Now check your website and I hope you site is now ready to go.

Note: You should check all of your tables that does not containing anything that start with the old prefix. If it does, your site definitely down again near future or do not up in the first time. As I’m writing this article based on a fresh installation so I don’t have many options, meta, key values in my database but if your website is old and you want to rename your prefix then you have to find out more.

Lastly and most importantly, do not forget to back up your database before you do anything in it. It’s really good practice backing up database before any modification. I guaranty it’ll make your WordPress website secure from any kind of harmful attract.

That’s all I’ve for this article.

So, If you’ve enjoyed my article, please don’t hesitate to share this with your friends who live with WordPress. 🙂

Cheers! (Y)

You can find the video replica of this post here.