I have multiple twitter widgets on my site but only wish to show a specific widget alongside a specific post. I would like to use CSS to identify the unique widget and then set it as hidden or displayed. Can I use data-widget-id as a possible selector?
We’ve added new annotations to all rendered widgets to try and make it easier to interact with the widget as a developer. You should find that when rendered a timeline widget (identified with
class="twitter-timeline") will have a
data-widget-id field (corresponding to the
data-widget-id on your original embed code) and a
data-user-id for profile widgets, and
data-search-query for searches.
We shipped this a few weeks ago and I’ve been meaning to post a message here about some of these new hooks. We’ll get them written up and properly announced in due course. But I’m glad you found it, and yes, these kinds of use cases are exactly what the attribute annotations are for.
Let us know how you get on! Thanks!