29 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’ )); } ?>

29 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! ;-)

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by