-
Notifications
You must be signed in to change notification settings - Fork 9
NO-JIRA: Twitter feed fix #80
base: main
Are you sure you want to change the base?
Conversation
Fixed an issue where the Twitter feed was not appearing on the front page. This has been fixed by removing the expired keys from function.php, and adding use of the oAuth Twitter Plugin.
@cindyli I realize that there should be a check for the getTweets() function. Otherwise a PHP exception would be thrown and the remainder of the page would not load. I'll update this now. |
@cindyli done. I added a check for the getTweets function. Now it just returns if the getTweets function does not exist. |
README.md
Outdated
@@ -0,0 +1,4 @@ | |||
This is the Wordpress theme for inclusivedesign.ca, the website of the Inclusive Design Institute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to add a link that explains how to use a Wordpress theme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another helpful note in the readme is, after "oAuth Twitter Feed for Developers plugin" is installed, follow its installation doc to provide the consumer key/secret etc in the admin settings page in order to get tweets displayed. This step is easy to be missed.
functions.php
Outdated
/* Use the "oAuth Twitter for Developers" plugin to get the Twitter feed. | ||
https://en-ca.wordpress.org/plugins/oauth-twitter-feed-for-developers/ */ | ||
if (function_exists('getTweets')) { | ||
$tweet_count = 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable should be defined as a constant instead of hiding deep in the script.
functions.php
Outdated
$out .= $twitter_username.'" title="Follow @'.$twitter_username.'">@'.$twitter_username.'</a><ul>'; | ||
if (!empty($tweets)) { | ||
foreach ($tweets as $tweet) { | ||
$out .= '<li class="tweet"><div class="tweet-date">'.substr($tweet[created_at], 0, 16).'</div>'.$tweet[text].'</li>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing quotes at accessing array elements:
$tweet[created_at] -> $tweet['created_at']
$tweet[text] -> $tweet['text']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the twitter plugin is installed but the consumer key and secret is not provided, this error will appear a number of times on the front page:
Warning: Illegal string offset 'created_at' in /.../wp-content/themes/idi-theme/functions.php on line 142
Fixed an issue where the Twitter feed was not appearing on the front page. This has been fixed by removing the expired keys from function.php, and adding use of the oAuth Twitter Plugin.
@cindyli can you take a look at this pull request? Thanks.