Moving WordPress

Moving WordPress

Whether you are moving WordPress to a new server or to a different location on your server, you don't need to reinstall. WordPress is flexible enough to handle all of these situations.

Moving to a New Server

If you are moving WordPress from one server to another, begin by backing up your WordPress directory, images, plugins, and other files on your site as well as the database. See WordPress Backups and Backing Up Your Database.

Keeping Your Domain Name and URLs

Moving your domain without changing the Home and Site URLs of your WordPress site is very simple, and in most cases can be done by moving the files.

  • If database and URL remain the same, you can move by just copying your files and database.
  • If database name or user changes, edit wp-config.php to have the correct values.
  • If you want to test before you switch, you must temporarily change "siteurl" and "home" in the database table "wp_options" (through phpMyAdmin or similar).
  • If you had any kind of rewrites (permalinks) setup you must disable .htaccess and reconfigure permalinks when it goes live.

Changing Your Domain Name and URLs

Moving a website and changing your domain name or URLs (i.e. from http://example.com/site to http://example.com, orhttp://example.com to http://example.net) requires the following steps - in sequence.

  1. Download your existing site files.
  2. Export your database - go in to MySQL and export the database.
  3. Move the backed up files and database into a new folder - somewhere safe - this is your site backup.
  4. Log in to the site you want to move and go to Settings > General, then change the URLs. (ie from http://example.com/ tohttp://example.net ) - save the settings and expect to see a 404 page.
  5. Download your site files again.
  6. Export the database again.
  7. Edit wp-config.php with the new server's MySQL database name, user and password.
  8. Upload the files.
  9. Import the database on the new server.

When your domain name or URLs change there are additional concerns. The files and database can be moved, however references to the old domain name or location will remain in the database, and that can cause issues with links or theme display.

If you do a search and replace on your entire database to change the URLs, you can cause issues with data serialization, due to the fact that some themes and widgets store values with the length of your URL marked. When this changes, things break. To avoid that serialization issue, you have four options:

  1. Use the Velvet Blues Update URLs plugin if you can access your WP Admin Dashboard.
  2. Use the Better Search Replace plugin if you can access your WP Admin Dashboard.
  3. Use WP-CLI's search-replace if your hosting provider (or you) have installed WP-CLI.
  4. Use the Search and Replace for WordPress Databases Script to safely change all instances on your old domain or path to your new one. (** only use this option if you are comfortable with database administration ** )

Note: Only perform a search and replace on the wp_posts table.
Note: Search and Replace from Interconnectit is a 3rd party script

Moving Directories On Your Existing Server

Moving the WordPress files from one location on your server to another - i.e. changing its URL - requires some special care. If you want to move WordPress to its own folder, but have it run from the root of your domain, please read Giving WordPress Its Own Directory for detailed instructions.

Here are the step-by-step instructions to move your WordPress site to a new location on the same server:

  1. Create the new location using one of these two options:
    1. If you will be moving your WordPress core files to a new directory, create the new directory.
    2. If you want to move WordPress to your root directory, make sure all index.php, .htaccess, and other files that might be copied over are backed up and/or moved, and that the root directory is ready for the new WordPress files.
  2. Log in to your site.
  3. Go to the Administration > Settings > General panel.
  4. In the box for WordPress Address (URL): change the address to the new location of your main WordPress core files.
  5. In the box for Site Address (URL): change the address to the new location, which should match the WordPress (your public site) address.
  6. Click Save Changes.
  7. (Do not try to open/view your site now!)
  8. Move your WordPress core files to the new location. This includes the files found within the original directory, such ashttp://example.com/wordpress, and all the sub-directories, to the new location.
  9. Now, try to open your site by going to yourdomain.com/wp-admin. Note, you may need to go to yourdomain.com/wp-login.php
  10. If you are using Permalinks, go to the Administration > Settings > Permalinks panel and update your Permalink structure to your.htaccess file, which should be in the same directory as the main index.php file.
  11. Existing image/media links uploaded media will refer to the old folder and must be updated with the new location. You can do this with the Velvet Blues Update URLs or Better Search Replace plugins, WP-CLI's search-replace if your hosting provider (or you) have installed WP-CLI, manually in your SQL database, or by using the 3rd party database updating tool Search and Replace Databases Script * Note: this script is best used by experienced developers.
  12. In some cases your permissions may have changed, depending on your ISP. Watch for any files with "0000" permissions and change them back to "0644".
  13. If your theme supports menus, links to your home page may still have the old subdirectory embedded in them. Go to Appearance > Menus and update them.
  14. Sometimes you would need to restart your server, otherwise your server may give out an error. (happens in MAMP software (Mac)).

It is important that you set the URI locations BEFORE you move the files.

If You Forget to Change the Locations

If you accidentally moved the files before you changed the URIs: you have two options.

  1. Suppose the files were originally in /path/to/old/ and you moved them to /path/to/new before changing the URIs. The way to fix this would be to make /path/to/old/ a symlink (for Windows users, "symlink" is equivalent to "shortcut") to/path/to/new/, i.e. ln -s /path/to/new /path/to/old and then follow the steps above as normal. Afterwards, delete the symlink if you want.
  2. If you forget to change the WordPress Address and Blog Address, you will be unable to change it using the wordpress interface. However, you can fix it if you have access to the database. Go to the database of your site and find the wp_options table. This table stores all the options that you can set in the interface. The WordPress Address and Blog Address are stored as siteurl and home (the option_name field). All you have to do is change the option_value field to the correct URL for the records withoption_name=’siteurl‘ or option_name=’home‘.

If You Have Accidentally Changed your WordPress Site URL

Suppose you accidentally changed the URIs where you cannot move the files (but can still access the login page, through a redirection or something).

wp-login.php can be used to (re-)set the URIs. Find this line:

require( dirname(__FILE__) . '/wp-load.php' );

and insert the following lines below:

//FIXME: do comment/remove these hack lines. (once the database is updated)
update_option('siteurl', 'http://your.domain.name/the/path' );
update_option('home', 'http://your.domain.name/the/path' );

You're done. Test your site to make sure that it works right. If the change involves a new address for your site, make sure you let people know the new address, and consider adding some redirection instructions in your .htaccess file to guide visitors to the new location.

Changing The Site URL also provides the details of this process.

Managing Your Old Site

Shutting It Down

  1. Download a copy of the main wordpress files from your OLD site to your hard drive and edit wp-config.php to suit the new server.
  2. Go back to your OLD site and go to Administration > Settings > General and change the URL (both of them) to that of your new site.
  3. Login on your server, go to phpMyAdmin, export as file, and save your database (but keep the old one just in case). Now, upload this new database and the copy of the wordpress core files with the edited wp-config.php to your new server. That's it!

Keeping it Running

Caution: Make sure you have a backup of your old site's WordPress database before proceeding!

Part A - Activating Your New Site

  1. Download your entire WordPress installation to your hard drive. Name the folder appropriately to indicate that this is your OLD site's installation.
  2. Download your database.
  3. Go back to your OLD site and go to options and change the url (both of them) to that of your new site.
  4. Again, download your entire WordPress installation to your hard drive. Name the folder appropriately to indicate that this is your NEW site's installation.
  5. Download your database once again (but keep the old one). Upload this database to your new server. It will be easiest if you use the same database name and you create a user with the same login credentials on your new server as on your old server.
  6. If you used a different database name and/or user (see previous step), edit wp-config.php in your NEW site's installation folder appropriately.
  7. Upload the NEW site's installation folder to your new site. Presto, your NEW site should be working!

Part B - Restoring Your Old Site

  1. On the original server, delete your OLD site's database (remember, you should have a copy on your local computer that you made at the very beginning).
  2. Upload your OLD site's installation folder to your original server, overwriting the files that are currently there (you may also delete the installation folder on the server and simply re-upload the OLD site's files).
  3. Upload your OLD site's database from your local computer to the server. That should do it!

Another procedure for making copies of posts, comments, pages, categories and custom field (post status, data, permalinks, ping status, etc.) easy to follow:

  1. Install a new WordPress site
  2. Go on old site Admin panel. Here, in Manage > Export select "all" in menu Restrict Author.
  3. Click on Download Export File
  4. In new site go on Manage > Import, choose WordPress item.
  5. In the page that will be shown, select the file just exported. Click on Upload file and Import
  6. It will appear a page. In Assign Authors, assign the author to users that already exist or create new ones.
  7. Click on Submit
  8. At the end, click on Have fun

Note: using this method, if there are some articles in the new site (like Hello World, Info Page, etc.), these will not be erased. Articles are only added. Using the former procedure, the articles in new site will be deleted.

Moving WordPress Multisite

Multisite is somewhat more complicated to move, as the database itself has multiple references to the server name as well as the folder locations. If you're simply moving to a new server with the same domain name, you can copy the files and database over, exactly as you would a traditional install.

If, instead, you are changing domains, then the best way to move Multisite is to move the files, edit the .htaccess and wp-config.php (change DOMAIN_CURRENT_SITE and, if the folder name containing Multisite changed, PATH_CURRENT_SITE), and then manually edit the database. Search for all instances of your domain name, and change them as needed. This step cannot yet be easily automated. It's safe to search/replace any of the wp_x_posts tables, however do not attempt blanket search/replace without the Search and Replace for WordPress Databases script (aka the interconnectit script).

If you're moving Multisite from one folder to another, you will need to make sure you edit the wp_blogs entries to change the folder name correctly. You should manually review both wp_site and wp_blogs regardless, to ensure all sites were changed correctly.

Also, manually review all the wp_x_options tables and look for three fields and edit them as needed:

  • home
  • siteurl
  • fileupload_url

If you are moving from subdomains to subfolders, or vice-versa, remember to adjust the .htaccess file and the value forSUBDOMAIN_INSTALL in your wp-config.php file accordingly.


A Step By Step Guide to Migrating Your WordPress Website To A New Web Host

A Step By Step Guide to Migrating Your WordPress Website To A New Web Host

Moving your website to a new host can be a daunting and stressful experience, but it doesn’t need to be.Many people are faced with the need to move to a new host because of problems with their current provider and have just had enough. But all too often, migrating to a more reliable host is delayed time and again for fear of making a mistake and damaging your site(s).To get around the problem, people will either pay a professional to move their site for them, find a new host that offers the service as part of a new hosting package, or take the third option of having a go at it themselves.

If you spend a little time preparing your own website, migrating is nothing to be concerned about. It can be a very straightforward project if approached correctly and can easily be reversed out of should any problems occur.

Let’s run through the steps required to move your WordPress website to a new host.

Step 1: Back Up Your Website’s Files

The very first step of any project such as this is to back up every aspect of your site. This step is good practice before any major change but it is also a requirement of migrating your WordPress installation.

There are many plugins out there that will completely backup your site for you. This backup however, requires a more manual approach. Using an FTP program (such as FileZilla), connect to your web host and copy all files under your website’s directory to a folder on your local computer.

This includes the .htaccess file that is set to be hidden. Consult your FTP program’s help file to have it display hidden files if you are unable to see this file.

Depending on the number of media uploads you have in your site, this could take some time. While this download is underway we can begin step two and make a copy of your database.

Step 2: Export The WordPress Database

Exporting your database is a simple process that only requires a few steps to complete. Login to the cPanel account of your web server and open the phpMyAdmin application. Select the database that contains your WordPress installation from the list on the left hand sidebar and once selected click on the Export tab on the navigation menu.

The default settings of a Quick export and the SQL format for the export are sufficient for what we need. Click the Go button and the database export process will begin and a file will be downloaded to your local computer.

Once the database export and the FTP transfer of your files have both completed, you are ready to move onto the next stage.

Step 3: Create The WordPress Database On Your New Host Server

Before we can begin the migration to the new web host, we need to create an environment for a WordPress installation. To do this you must create a database that you can import your SQL data into.

Login to your new web host with the user credentials they have supplied you and connect to the cPanel software. For our guide we will be using the MySQL Databases application. If your web host doesn’t have that application running then you will should contact their support team to discover their method of creating new databases.

The steps to create a database are quite simple:

  • Open MySQL Database and create a new database with an appropriate name for your website.
  • Create a new MySQL user (with a secure password).
  • Add this user account to the new database and grant it All Privileges.

Write down the database name, the new MySQL username and its password. You will need them soon.

Step 4: Edit the wp-config.php File

Browse to the folder on your local computer where you downloaded your website files to. In that folder there is a file called wp-config.php that controls the access between WordPress and your database.

Make a copy of this file and store it in another folder on your local computer. This is necessary for restoring the changes we are about to make should something go wrong later.

Open the original version of the file with your favorite text editor and make the following three changes:

1. Change The Database Name

Locate the following line:

define('DB_NAME', 'db_name');

The db_name portion of this line will currently be set to the MySQL database name of your old web host. This must be changed to the name of the new database you have just created.

2. Change the Database Username

Below this you will find the line:

define('DB_USER', 'db_user');

In this line you need to change the db_user portion from the username of your old host to match the new username you have just created.

3. Change The Database User Password

Finally, edit the third line:

define('DB_PASSWORD', 'db_pass');

As with the others the db_pass section of this line must be changed to the new secure password you created for your MySQL user.

Save wp-config.php and close the file.

Step 5: Import Your Database

Now that you have a new database to work with we can begin the import process.

Launch phpMyAdmin from the cPanel software on your new server and select your new database from the list on the left hands sidebar. Once it opens select the Import tab from the navigation menu.

In the File to Import section click the Choose File button and select the SQL file you exported previously.

Un-tick the Partial Import check box, make sure the format is set to SQL and then click the Gobutton. The database import will now begin.

The time this import takes varies depending on the size of your database. You should receive a message informing you of the success of the import when it has finished.

Step 6: Upload The WordPress Files To Your New Host

Now that you have the new database prepared and you’ve reconfigured the wp-config.php file, it is time to begin uploading your website’s files.

Connect to your new web host using your FTP program and browse to the folder that your website is going to be held. If this is the primary, or only site being installed on this web server then uploading the files to the public_html folder is the usual directory.

With the remote directory selected you can upload your website files that should now include the updated version of wp-config.php. As with the earlier download, this process can take some time.

Don’t delete these files from your local computer once the upload finishes. They are still needed until the final steps have been completed.

Step 7: Linking to New URL & Defining New Domain

One issue people always seem to have when moving their site is that they’ve added links to other posts on their site or inserted images directly by pointing to a URL on the server, causing these to break when moved over to a new domain. If you want to quickly and easily search for any instances of your old domain name and replace with the new name I (AJ Clarke) suggest you take a look at the Search Replace DB script on github. This will allow you to do this with great ease. Just make sure you DELETE it when your are done (for security reasons).

Make sure you are running the search and replace on the new domain you are transferring the site to not the old one.

Changing Site URL: By doing a search and replace for the old domain and replacing with the new domain you’ll also be altering the site_url and home url values in the database (Changing the Site URL) which will ensure that when you try to log into your site on the new domain it doesn’t try and redirect you over to the old domain.

* This small subsection was an added note by AJ Clarke.

Step 8: The Final Touches

This step actually includes two separate things with (potentially) several days between them.

Before you can use the site on your new host you will need to reconfigure your domain’s DNS settings. They will be set to point to your old host and you will need to point the correct records to the new server IP address.

This process will depend on where you have your domain registered. The details of completing this process are too varied to discuss in this post, but your domain registrar should have all of the details you need to make this change.

DNS changes can take up to 48 hours to fully propagate. It’s best to do this at a period when you expect lower levels of traffic. During this 48 hour window you should avoid making any changes to your website as you may be changing the old version of the site.

After the 48-hour period has expired you should now be accessing the new web host when you go to your website. It’s at this point you can connect to your old web host to delete the files and database. You should still have a local backup copy of these files and the database export, along with the original wp-config.php file in case you need to roll back the migration. It can be a good idea to hold onto these files for a an extended period just to be on the safe side.

Conclusion

As you can see, when broken down into the above simple steps, the process isn’t that difficult.All it really requires is for you to be careful at each step and give yourself the option to go back to the original version until the last possible moment (in case of any problems).

Have you migrated your WordPress website recently? Let us know your experience with the process in the comments section below!


How to Protect Site Content from Copying?

How to Protect Site Content from Copying?

Hello, today we'll check on how to prevent copying your content from site. If you're a site owner and spend lot of your time on creating the nice-looking and interesting website for Internet users, it's consequential to want to keep your unique content protected.

Luckily, it can be easily done within your WordPress admin panel and there's no need to make lot of efforts on keeping your data secure. Just follow the simple steps, listed below.

  1. First you'll need to download the WP Content Copy Protection & No Right Click plugin from the official WordPress plugins repository. In order to do this just visit the plugin's page and press the Download button.
  2. Save the archive of the plugin's latest stable release to your computer, and you're ready with all the preparations. Now we can move forward installing the plugin to your website.
  3. So, open your site admin panel and upload the downloaded archive to Plugins -> Add new section.
  4. After the plugin has been installed, WordPress will ask you to activate it. Press the Activate Plugin link to do this, or navigate to Plugins -> Installed Plugins and press the Activate button below the plugin's title.
  5. Your site prevents content copying now. You can manage the plugin's settings at theProtection section, in order to open it just click on the corresponding label at the top bar or visit Settings -> WP Content Copy Protection page.
  6. As you can see, at the Main Settings tab you can enable JavaScript protection for Home page, single Posts pages and for static Pages. The Premium RightClick Protection tab allows to block the right mouse click event on these pages as well.
  7. The Premium Protection by CSS tab allows to enable CSS protection on your site Home page ina free version of the plugin, and the Pro version includes the Posts and Pages Protection by CSS.
  8. Feel free to visit the More with pro tab to check for the plugin's Pro version advantages. However, site is already protected, even with a free plugin's version installed.

How to Reduce Post Revisions in WordPress Website?

We are ready to present you a brand new WordPress hack. Today we'll be dealing with posts revisions count reduction.

What is posts revisions? It is a feature introduced in WordPress 2.6. Whenever you or WordPress saves a post or a page, it automatically creates a revision and stores in your WordPress database.

Why should we reduce their count? Each additional revision will slowly increase the size of your WordPress database. If you save a post or page multiple times, your number of revisions will greatly increase overtime. For example, if you have 100 posts and each post has 10 revisions you could be storing up to 1,000 copies of older data!

So if you need keep your website fast and optimized, do not hesitate to use the advice we are going to present you below.

To reduce post revisions, you need to go to the root of your WordPress installation using cPanel File Manager or FTP. The file you will need to edit is named wp-config.php Open this file and copy this string of code to it:

define('WP_POST_REVISIONS', X);

Where X should be replaced with the number of the revisions you'd like to have.

Note! It is recommended to copy this command to the first line under the initial block comment in wp-config.php.

How_to_reduce_post_revisions_2

Now if you save the changes and refresh your WP Dashboard that should be it. No more redundant data and no issues with website load speed.


How to Add More Navigation Menus to Your WordPress Theme

How to Add More Navigation Menus to Your WordPress Theme

This guidance will explain you how to add more navigation menus to your WordPress Theme. Sometimes you may need to add an extra navigation menu with important or frequently used links to increase the usability of your WordPress site.

To create a new menu you need to edit your theme files. Before making changes to any of your core files, it's best to backup your entire site in case something goes wrong along the way.

To add a new menu location option in your admin dashboard under Appearance > Menus you need to 'register a menu'. All it takes is adding a snippet of code to your 'functions.php' file located under /wp-content/themes/your_theme/ directory on the server.

Registering New Menu

Access your server using ftp client or FileManager provided by your host. Navigate to /wp-content/themes/your_theme/ directory on your server. Open the 'functions.php' file for editing.

Scroll to the bottom of the file. If you'd like to add only one menu, add the following code on a new line:

function register_my_menu() {
register_nav_menu('additional-menu',__( 'Additional Menu' ));
}
add_action( 'init', 'register_my_menu' );

In this example, 'Additional Menu' is the name that will appear in your admin dashboard's menu page. The 'additional-menu' name is what WordPress will understand to execute your code properly.

If you would like to add multiple menus to your site, add this code on a new line instead:

function register_my_menus() {
register_nav_menus(
array(
 'additional-menu' => __( 'Additional Menu' ),
 'another-menu' => __( 'Another Menu' ),
 'extra-menu' => __( 'Extra Menu' )
 )
 );
}
add_action( 'init', 'register_my_menus' );

You can add as many new menus as you'd like with this method. The same rules will apply when naming them. Save the changes you made to the file.

Creating new Menu in WordPress Dashboard

Head over to Appearance > Menus in your dashboard. You'll notice your new menus will be listed under Theme Locations in the Manage Location section.

Feel free to create a new menu or use an existing one. Once you have created a new menu, you can also manage the locations where they are displayed under the 'Manage Locations' tab.

Adding Menu Locations to Your Theme

This is where you need to decide where you'd like to place your menu. If you'd like your menu to appear at the top of your page, you'll need to edit the 'header.php' file. You can also put it in your footer which means you would edit the 'footer.php' file. You can even display a menu on a page by editing its template file or to a sidebar, editing its 'sidebar.php' file.

You can place your new menu where ever you'd like. Here's the minimum amount of code you need to add to any of these locations:

<?php wp_nav_menu( array( 'theme_location' => 'additional-menu' ) ); ?>

Where additional-menu is your new menu.

You probably want to style your menu with CSS so it goes beyond basic functionality and also looks great. To do this, you'll need to create a class and add it to your theme with the following code:

<?wp_nav_menu( array( 'theme_location' => 'additional-menu', 'container_class' => 'new_menu_class' ) ); ?>

Again, replace additional-menu with the menu name you chose. We created 'new_menu_class'class as an example, feel free to specify your own style class here. Do not forget to add style rules for the new created class in your style.CSS file which is located under /wp-content/themes/your_theme/ directory on the server.

This is it, your theme got an additional menu and now you are one step closer to the greatest site ever.


How to Create Custom 404 Page in WordPress?

How to Create Custom 404 Page in WordPress?

This article is going to show you how to create custom 404 page on the WordPress site.

In WordPress the 404 error page is part of the theme. However, this feature will work as long as you set the Permalink Structure to anything else but Default (Plain) under the Settings -> Permalinks section in the admin panel.

The best solution to create and customize your own 404 error page is to use a plugin. We recommend using 404page plugin. It allows you to create and edit your 404 error page as a normal page using the full power of WordPress and making use of all installed plugins and available shortcodes.

Price: Free

In order to install and use the plugin, you need to:

  • download plugin file;
  • install and activate it under the Plugins -> Add New -> Upload Plugin section in your WordPress admin panel.

Once the plugin is installed and activated, navigate to the Appearance -> 404 Error Page section in the admin panel. You can manage the plugin's settings there.

In order to create your custom 404 error page, you need to navigate to the Pages -> Add new section in the WordPress dashboard, and create a new page there.

Once the page is created, go back to the Appearance -> 404 Error Page section. Let's review the plugin's settings:

  • Page to be displayed as 404 page - this option allows you to select the needed page that will be used as the 404 error page on your website. Choose your created 404 error page in the drop-down list, and press the Save changes button below.Once the page is selected and changes are saved, you can click the Test 404 error button to test it.Also, the Edit page button allows you to edit your custom 404 error page directly from here.

     

  • Hide 404 page - activating this option hides the page you selected as custom 404 error page from the Pages menu for non admin users. For admin users it is always visible and marked with the 404page icon.
  • Fire 404 error - this option is activated by default and it is recommended not to change this setting. With this option WordPress fires an 404 error in case the page you selected to be your custom 404 error page is accessed directly by its permalink. The only reason to deactivate this option is if you explicitly want the page to be accessible otherwhere.
  • Operating Method - this setting has two options: Standard Mode and Compatibility Mode.Standard Mode is the default operating method and should work in most cases. This mode uses the WordPress Template System to detect and handle 404 errors. However, some plugins and themes bypass this task, thus the 404page plugin does not work properly. In such cases you need to switch to Compatibility Mode.

That's it. Now you know how to create 404 page on your WordPress website.


How to See Who’s Online on Your WordPress Website?

How to See Who’s Online on Your WordPress Website?

Hi there! New hack is coming. Today we are going to show you how to see real time online users statistic on your WordPress website.

The best and fastest workaround is a plugin. You can use WP-UserOnline plugin. It allows you to see full statistics about your site visitors.


As usual we will start with the plugin installation. Download WP-UserOnline plugin fromwordpress.org.

Price: Free

Navigate to Plugins > Add New page in your WordPress admin panel. Browse plugin file you downloaded. Do not forget to activate plugin after upload.

After plugin is activated, we can change default plugin settings. Open Settings > UserOnline page in your site backoffice.

You will see general plugin settings reflected here. The first section is UserOnline options:

  1. Time out. How long until it will remove the user from the database (in seconds).
  2. UserOnline URL. URL To UserOnline Page. Copy this link you will need it further during statistic page creation.
  3. Link user names? option. You can link user names to their author page here.
  4. Naming Conventions lets you to set up default static data titles.

The plugin has several templates available.

  1. User(s) online.
  2. User(s) Browsing Site.
  3. User(s) Browsing Page.

Here you can modify UserOnline pages layout and content.


Now we can proceed to the next step. You can add user online counter to our site. There are several ways to do this:

  1. Using widget:
    • Visit Appearance > Widgets page in your back-end.
    • Locate widget titled UserOnline.
    • This widget has several statistics available:
      • Users online count;
      • Users browsing current page;
      • Users browsing site;
      • Users online count & users browsing current page;
      • Users online count & users browsing site.
    • Place widget to position you wish your users statistics to appear. The result will be as follows:
  2. Adding it to the page:
    • Visit Pages > All Pages section in your admin panel to add statistic page.
    • Click Add New at the top left corner to add new page.
    • Enter your page title. And add following shortcode to the page content field:
      [page_useronline]
    • The next step will be page permalink change. Please, locate Permalink section under the page title field. Click Edit button to change the permalink. Remember, we UserOnline URLfield on the plugin settings page? Page permalinks was /useronline there. Please, check your newly created page permalink to /useronline .
    • Click Publish to save the changes. Now if you what your page to be visible from your site frontend , you can add it to the menu under Appearance > Menus page in your backend. Or leave it as it is, to view the page you can click link under the page title in your admin panel.From screenshot above you can see that 2 guests are viewing site at this moment. You can see page they visit and time when they opened your site.
  3. Using php code:
    • WP-UserOnline plugin creators recommend adding php code to the theme sidebar.php file.
    • You can locate that file in wp-content/themes/themeXXXXX (XXXXX is theme number) directory on your server.
    • The code you need to add is:
      <?php if (function_exists('users_online')): ?>
      	<p>Users online: <div id="useronline-count">
      	<?php users_online(); ?>
      	</div></p>
      <?php endif; ?>
    • Once you add this code a field with site visitors statistic will appear on your site.

That is it! You know how to add user static to your site now and find out who is online.


How to Add Custom Button to the WP Editor?

How to Add Custom Button to the WP Editor?

Here comes another WordPress hack for you. Today we’re going to show you how add custom button to your WordPress editor.

Even though the editor itself has a great number of text formatting options sometimes it happens that some specific thing is lacking.

So here’s an easy way how to add a button in just a few minutes.

There’s a number of ways how you get this done, but we’re going to show you the easiest and the fastest way.

Go to wordpress.org and find the plugin Visual Editor Custom Buttons, or use this link.

Price: Free

This plugin is regularly updated and comes from a trustworthy developer.

Download the plugin and install it. After installation you will find new menu item inside your dashboard.

Now let’s create a button. As an example I will create a button for an H3 tag.

Hit Add new and the button editor will open.

Now you need to fill in the blanks:

  • Button name;
  • Opening tag;
  • Closing tag;
  • And CSS formatting (if necessary).

You can choose where your new button will appear: either in the Visual Editor or in the Text Editor, and its icon.

After you’ve filled in all blanks hit Publish.

Now open your post editor and on the panel you will find you new button.

That’s it


How to Cloak Affiliate Links in WordPress?

How to Cloak Affiliate Links in WordPress?

Today we’re going to show you an easy and bulletproof way of masking affiliate links.

There are two possible ways how one can do it:

  • Via installing a plugin.
  • Via editing .htaccess file

The first option is quite easily and can be done in just a few minutes, while the second one requires an FTP access and more precision of yours.

Let’s Start

What’s a link (masking) cloaking? It’s a method of turning long and ugly affiliate links into shorter and branded.

This means that something like this:

http://someaffiliatewebsite.com/product/productid?aff=your.affiliate.id

...can be transformed into this:

http://yourwebsite.com/refer/productname

Why Cloak Links?

  • You’ll be able to track clicks thus understand how many money those clicks have made.
  • You’ll be able to protect your links from hijacking (yes, there are people who can do it).

The Plugin Method

Among all affiliate cloaking plugins we’re going to choose ThirstyAffiliates plugin. It’s super-easy to use and with its help you’ll be able to transform all your ugly affiliate links into user friendly ones.

  1. Enter your WordPress website admin panel
  2. Go to the plugins section, hit Add new
  3. Into the search type in the name of the plugin ThirstyAffiliates
  1. Hit Install Now
  2. Inside your dashboard a new menu item will appear
  1. Hover Affiliate Links menu item and click Add New
  2. Affiliate link editor will load
  1. Now you need to add link name and the UPR itself, don’t forget to tick Open this link in new window?
  1. Hit Save Link, and your user-friendly URL is ready.

Just copy and paste it where it was.


How Do I Find php.ini File in WordPress?

How Do I Find php.ini File in WordPress?

If you’re dealing with WordPress, sooner or later you have to ask yourself this question. Although not directly connected to WordPress, php.ini is one of the most important configuration files on your server because it is responsible for configuring your PHP installation, and in such a way your WordPress site and php.ini often go hand in hand.

The most frequent parameter that you might need to change is upload_max_filesize. By default it’s 2Mb, which can be quite low. Other popular ones include register_globals, safe_mode, and max_execution_time. You can also use this file to enable or disable extensions of your PHP installation.



Depending on your system and server environment there are different places and ways you can find the php.ini file.

The best way to find php.ini

Whether you’re working on localhost, or on a live server, the most easy and proven way to locate your php.ini file is to create a php file with a single line of code in it, and view the output.

  • Create a file (name it however you want, in our case it’s ‘test.php’), and make sure it ends with .php extension.
  • Put this line of code in it:
<?php phpinfo(); ?>
  • Open the file via your browser. For exapmple if you placed it into your root folder, run http://mywebsite.com/test.php.

Your php.ini file should be located either in the ‘Configuration File Path’ section, or like in my case in ‘Loaded Configuration File’ section. The first location is the default one, the second location applies in case your PHP installation is used as a module.

Other solutions

If in some cases creating a php file and inserting a single line of code doesn’t work for you, there are some other ways to find php.ini.

Local server

If you’re working locally, finding php.ini would depend on the server environment you’re using. Let’s go quickly through some of the most popular ones.

WAMP

Left click on your WAPM server icon, then go to PHP -> php.ini. Easy? Easy.

XAMPP

XAMPP is a bit different beast, but also can be tamed without much difficulty. Run your XAMPP installation, right click the ‘Config’ button (in front of the Apache module) and here it is, our little guy:

php.ini-on-localhost-XAMPP

Linux

If you’re on Linux, run the following command in the terminal:

php -i | grep "Loaded Configuration File"

It should output something like this:

Loaded Configuration File => /usr/local/lib/php.ini

In most cases the php.ini would be located in the ‘Loaded Configuration File’, but if it’s not there, replace the ‘Loaded Configuration File’ string with ‘Configuration File’.

Live server

The location of php.ini mostly depends on the hosting you’re using, but we’ll cover here some of the most common scenarios.

cPanel

Open your file manager, and navigate to the root directory. Our little guy should be sitting at the bottom.

If you don’t know how to find your root folder, simply go one level up your main public_html directory.

Shared Hosting

Unfortunately, if you’re on a shared hosting, you cannot access your php.ini file. The workaround would be to specify the needed configuration settings in your .htaccess file in the following pattern:

php_value name value

The name here represents the name of the PHP property you need to change. The same applies to the value. For example this line changes the maximum uploaded file size to 8 Mb:

php_value  upload_max_filesize  8M



Restart after the changes

If you made at least one change to php.ini file, you have to restart your server, otherwise the changes won’t apply. If you’re on Linux write the following command:

/etc/init.d/httpd restart

The WAMP users have to right click on the server icon in the toolbar, and choose ‘Restart all services’.

If you’re using XAMPP, go to the main dashboard, click the ‘stop’ button in front of the ‘Apache’ module, and then click the ‘start’ button again.

Final words

As you can see, finding php.ini can be both tricky and easy at the same time. I’ve tried to cover the most common solutions and server environments, and hope this guide would help you to finally locate this file. If you know any other ways to find php.ini, feel free to share your thoughts in the comments below.