27 posts
  • United Kingdom
  • Has been a member for 5-6 years
  • Exclusive Author
  • Bought between 50 and 99 items
ThorneMedia says

Currently working on a wordpress theme that i am utalising Optiontree to try and make setting up much easier.

I am having trouble regarding a snippet of code to try and get a value from a setting in optiontree to be fed into another php script (in this case a twitter followers count).

I have the backend of the twitter feed working fine, this is the snippet of code that is placed in the template file:

<?php echo getFollowers("twittername")." followers"; ?>

That works fine and displays the current number of followers of a set account.

Then i have this line of code:

<?php if ( function_exists( 'get_option_tree') ) { echo get_option_tree( 'twitter_name' ); } ?>

This outputs the twitter name fine.

My issue is creating one working line of code from the two, so the getFollowers reads the output of the optiontree option set in the admin panel for absolute ease of use to the user.

Can anyone point me in the right direction?

Regards

1148 posts
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • Has been a member for 4-5 years
  • Bought between 10 and 49 items
  • Exclusive Author
  • Envato Studio (Microlancer) Beta Tester
  • United States
fillerspace says

<?php if ( function_exists( ‘get_option_tree’) ) { echo getFollowers(get_option_tree( ‘twitter_name’ )); } ?>

27 posts
  • United Kingdom
  • Has been a member for 5-6 years
  • Exclusive Author
  • Bought between 50 and 99 items
ThorneMedia says

Many thanks,

Not only does it work no problem but also helps me understand the logic behind it.

Thanks again.

1148 posts
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • Has been a member for 4-5 years
  • Bought between 10 and 49 items
  • Exclusive Author
  • Envato Studio (Microlancer) Beta Tester
  • United States
fillerspace says

Glad I could help! Feel free to buy a copy of my photodune item to show your thanks! ;-)

by
by
by
by
by
by