I am using Tim Whitlock’s Latest Tweets plugin to display tweets.
I would like to modify the plugin’s default output. I have found the below in line 137 of the plugin file:
$final = apply_filters('latest_tweets_render_tweet', $html, $date, $link, $tweet );
if( $final === $html ){
$final = '<p class="tweet-text">'.$html.'</p>'.
'<p class="tweet-details"><a href="'.$link.'" target="_blank">'.$date.'</a></p>';
}
$rendered[] = $final;
And have come up with this filter to attempt to change the output:
add_filter('latest_tweets_render_tweet', 'modified_tweets', 10);
function modified_tweets( $html, $date, $link, $tweet ) {
$final = '<div class="col-sm-4">'.
'<p class="tweet-text2">'.$html.'</p>'.
'<p class="tweet-details"><a href="'.$link.'" target="_blank">'.$date.'</a></p>'.
'</div>';
$rendered[] = $final;
};
However, the output remains the same. Any ideas what I’m doing wrong?
You have to return that array, so add:-
after this:-
As DWX mentioned, you’re missing the
return
. But you don’t need to return an array, the original code is expecting a string:And also add the number of arguments after the priority when adding the filter: