Skip to content

Commit

Permalink
Widget: Added option to set DoNotTrack in Twitter Timeline Widget (#9359
Browse files Browse the repository at this point in the history
)

* Widget: Added option to set DoNotTrack in Twitter Widget

* Make the attribute filterable

* Make the attribute filterable #2

* Twitter Timeline: add DNT option via filter.

See #9359

* Twitter timeline: update new filter's docblock
  • Loading branch information
stevenlinx authored and dereksmart committed Jan 2, 2019
1 parent 3bf755f commit 9f52808
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/widgets/twitter-timeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,22 @@ public function widget( $args, $instance ) {
echo ' data-partner="' . esc_attr( $partner ) . '"';
}

/**
* Allow the activation of Do Not Track for the Twitter Timeline Widget.
*
* @see https://developer.twitter.com/en/docs/twitter-for-websites/timelines/guides/parameter-reference.html
*
* @module widgets
*
* @since 6.9.0
*
* @param bool false Should the Twitter Timeline use the DNT attribute? Default to false.
*/
$dnt = apply_filters( 'jetpack_twitter_timeline_default_dnt', false );
if ( true === $dnt ) {
echo ' data-dnt="true"';
}

if ( ! empty( $instance['chrome'] ) && is_array( $instance['chrome'] ) ) {
echo ' data-chrome="' . esc_attr( join( ' ', $instance['chrome'] ) ) . '"';
}
Expand Down

0 comments on commit 9f52808

Please sign in to comment.