Skip to content
Advertisement

Option selection and return specific object

I have two different methods that output tweets but from two different sources.

JavaScript

Both return objects that can be accessed using ->data for an array of tweets.

So I have $tweets_option = get_field('show_tweets_for'); which outputs either profile or list.

Then I have a loop that goes through:

JavaScript

What’s the best way for me to define it like this:

  • By default, ‘profile’ is selected on $tweets_option, which I want to output $tweets = Twitter::get_tweets();.
  • Let’s say someone selects ‘list’ from $tweets_option, how can I set $lists to equal $tweets so that it still runs through the tweets?

Thanks all!

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement