WP Plugin

Instructions for installing WordPress plugin

This part will instruct you in how to install and activate the plugin. Note, however this is not the final step! You will need to set proper time in order for it to work correctly.

  1. Go to Download page and download the latest version of the plugin.
  2. Upload wp-eq2missiontimers_v*.*.zip to your WordPress plugins directory, located in  <root>/wp-content/plugins/ and unzip the file. It will create a eq2missiontimers directory.
  3. Activate the plugin through the ‘Plugins’ menu in WordPress.

Link jQuery libraries

Depending on your template, you may need to link to jQuerry libraries. Most new WP templates usually include these, but in case yours doesn’t you will need to add following line to <head>

1
2
3
4
5
<head>
	<!-- ... -->
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
	<!-- ... -->
</head>

Link CSS style

One CSS file comes with this plugin. It’s copy of the one used on eq2lib and adjusted for that color scheme. If you wish to use that one, you can either link to it in <head> like jQuerry libraries, or copy the contents of the stylesheet into your template CSS file(s). If the default color scheme does not fit yours, please visit EQ2 Mission Timers Source: Customization if you wish to learn more about changing CSS.

1
2
3
4
5
<head>
	<!-- ... -->
	<link rel="stylesheet" type="text/css" href="style.css">
	<!-- ... -->
</head>

Setting up your plugin so it displays proper time

Unfortunately PHP currently doesn’t have an easy option to fetch date and time from another server. There are workarounds which I will implement in future updates, but for now the plugin calculates time based on your servers timezone. This means you will have to make small change in the code to adjust to proper time. Don’t worry, you don’t need any programming knowledge, all you’ll have to do is adjust time.

First open the following file in a text editor <root>/wp-content/plugins/eq2missiontimers.php and find the line:

1
$rawDateStart = date('F j, Y H:i:s', date_timestamp_get(DateTime::createFromFormat('F j, Y H:i:s', 'December 30, 2015 23:00:00')));

If you look at the end of that line you will see a date, ‘December 30, 2015 23:00:00’. This is the start date for the counter, and the only thing you will have to change.

So what happens during the code execution is quite simple. Script gets two dates, the starting date mentioned previously, and current date of the server where script is located. Using those two dates it will then calculate remaining time until they reset again. Problem, however, is when your server is located in different timezone. Then your website will display dates and times a few hours off. What you have to do is figure what is that difference for your server. All you have to do is either “remove an hour” from the date and continue doing so until timers on your site match the ones on EQ2Library.

For example if you’re removing hours, replace:

‘December 30, 2015 23:00:00’ with ‘December 30, 2015 22:00:00’

If, the difference is increasing, then do the opposite and add an hour. Keep in mind through, that once you add +1 to 23, you will actually have to use 00, but increase the date by one. So adding an hour would replace:

‘December 30, 2015 23:00:00’ with ‘December 31, 2015 00:00:00’

Test it out until you have configured it right. Your timers and mission names and locations should match the ones Library.

Customization and style

The code is highly adjustable to whatever you wish to use it for. Consult EQ2 Mission Timers Source: Customization if you wish to learn more about changing CSS.