Las llamo de la siguiente manera :
<?php $url = 'url del twitter'; echo get_twitter_followers('$url'); ?> (mostrar seguidores)
<?php echo get_option('twitter'); ?> (muestra twitter oficial)
Lo que quiero, es es que get_option twitter este dentro de get_twitter_followers para poder mostrar los seguidores del twitter oficial.
Intente poniendo:
<?php $url = 'url del twitter'; echo get_twitter_followers(get_option('twitter')); ?>
y otras formas mas, pero no lo puedo hacer funcionar, me devuelve 0 segduidores ( tengo mas de 0).
Funciones:
Código PHP:
function get_twitter_followers($url){
$data = file_get_contents("http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20from%20html%20where%20url=%22http://twitter.com/".$url."%22%20AND%20xpath=%22//a[@class='js-nav']/strong%22&format=json");
$data = json_decode($data);
$count = intval($data->query->results->strong[2]);
return $count; // Printing the count
}
Código PHP:
function add_gcf_interface() { add_options_page('Configuracion del tema', 'Configuracion del tema', '8', 'functions', 'editglobalcustomfields'); }
<div class='wrap'>
<h2>Configuracion del tema</h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p><strong>Usuario de Twitter:</strong><br />
<input type="text" name="twitter" size="45" value="<?php echo get_option('twitter'); ?>" /></p>
<p><input type="submit" name="Submit" value="Actualizar" /></p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="twitter" />
</form>
</div>
}