Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

NO-JIRA: Twitter feed fix #80

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

jhung
Copy link
Member

@jhung jhung commented Jun 23, 2017

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.

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.
@jhung jhung self-assigned this Jun 23, 2017
@jhung jhung requested a review from cindyli June 23, 2017 19:48
@jhung
Copy link
Member Author

jhung commented Jun 27, 2017

@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.

@jhung
Copy link
Member Author

jhung commented Jun 27, 2017

@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.
Copy link
Contributor

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.

Copy link
Contributor

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;
Copy link
Contributor

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>';
Copy link
Contributor

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']

Copy link
Contributor

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

@jobara jobara changed the base branch from master to main October 21, 2020 11:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants