mikesales83 / wordpress-digital-signage

Newcastle University's WordPress digital signage platform. Download the source or try the system out within a ready-to-run portable WAMP stack.
8 stars 0 forks source link

weather & side bar #3

Open baelinc opened 8 years ago

baelinc commented 8 years ago

I have the system setup and running. Where the weather widget is, this message is showing...

Notice: Undefined offset: 1 in C:\xampp\htdocs\wp-content\themes\digitalsignage\weather.php on line 21 Notice: Undefined offset: 1 in C:\xampp\htdocs\wp-content\themes\digitalsignage\weather.php

Have you seen this before?

Also, on the side bar, we do not use twitter. Is there a way to put a widget there?

Thanks for this awesome setup.

mikesales83 commented 8 years ago

Hello,

I've just resolved this issue myself and it appears to be due to the Yahoo Weather API endpoint changing.

As a quick fix, you can do the following:

$data = get_data("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%3D30079%20and%20u%3D'c'&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys");
$condition = get_match('/<yweather:condition\s+(?:.*\s)?text="(.*)"/isU',$data);

That should fix it (at least it seems to work here at Newcastle Uni!).

If you'd like to remove the Twitter widget from the sidebar, you just need to edit the following file: /wp-content/themes/digitalsignage/sidebar.php

Then remove the following:

<div class="twitter-title icon-twitter">&nbsp;<b>@<?php echo ($display_opts['twitter_id'] ? $display_opts['twitter_id'] : 'NclUniTweets'); ?></b></div>
<div id="twitter-timeline" class="query root var-narrow"></div>

You can now add Text widgets to the Sidebar widget area within WordPress. These widgets can contain either plain text or HTML/JS.

I'll be adding a new release of the system shortly which will contain the weather fix along with quite a few other general bugfixes.

Hope this helps.

Best wishes, Mike

baelinc commented 8 years ago

I made that change in weather.php, but now I am getting this error:

NOTICE: UNDEFINED OFFSET: 1 IN C:\XAMPP\HTDOCS\WP-CONTENT\THEMES\DIGITALSIGNAGE\WEATHER.PHP ON LINE 21

Have you seen this one before?

baelinc commented 8 years ago

It seems to be dealing with preg_match. Is there anyway you can update the weather.php on here?