I'm using this to display some tweets.
After using the override filters as shown here, it makes the timestamp that naturally occurs to disappear.
The author gives us an example that you can use to override the default markup like so:
add_filter('latest_tweets_render_tweet', function( $html, $date, $link, array $tweet ){
$pic = $tweet['user']['profile_image_url_https'];
return '<p class="my-tweet"><img src="'.$pic.'"/>'.$html.'</p><p class="my-date"><a href="'.$link.'">'.$date.'</a></p>';
}, 10, 4 );
Here is my version:
add_filter('latest_tweets_render_tweet', function($html){
return
'<div class="row">
<div class="small-1 columns twitter-icon-wrap">
<i class="fa fa-twitter tweet-icon fa-2x fa-pull-left"></i>
</div>
<div class="small-11 columns tweet-wrap">'.$html.'</div>
<p class="tweet-details"><a href="" target="_blank"></a></p>
</div>';
}, 10 , 1 );
If I add $date
after the $html
variable in the function like:
add_filter('latest_tweets_render_tweet', function($html, $date)
I then get a warning:
Warning: Missing argument 2 for ******\******\Extras\{closure}(), called in /srv/www/*********/current/web/wp/wp-includes/plugin.php on line 235 and defined in /srv/www/*******/current/web/app/themes/*********/lib/extras.php on line 144
line 144 is add_filter('latest_tweets_render_tweet', function($html)
If I subsequently add the $date
variable into the returned HTML ignorning the warning, I then get an error:
Notice: Undefined variable: date in.....
Although it's a warning, there is still no date displayed. How can I make the date re-appear?