27 posts
    Has collected 50+ items on Envato Market Located in United Kingdom Has been part of the Envato Community for over 5 years Sells items exclusively on Envato Market
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
    Has referred 1+ members Has sold $1,000+ on Envato Market Has been a beta tester for an Envato feature Has collected 10+ items on Envato Market
+3 more
fillerspace says

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

27 posts
    Has collected 50+ items on Envato Market Located in United Kingdom Has been part of the Envato Community for over 5 years Sells items exclusively on Envato Market
ThorneMedia says

Many thanks,

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

Thanks again.

1148 posts
    Has referred 1+ members Has sold $1,000+ on Envato Market Has been a beta tester for an Envato feature Has collected 10+ items on Envato Market
+3 more
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