Last active
August 29, 2015 13:57
-
-
Save ximosa/9598945 to your computer and use it in GitHub Desktop.
PHP en widgets de texto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Ejecutar PHP en widgets de texto | |
function ejecutar_php($html){ | |
if(strpos($html,"<"."?php")!==false){ | |
ob_start(); | |
eval("?".">".$html); | |
$html=ob_get_contents(); | |
ob_end_clean(); | |
} | |
return $html; | |
} | |
add_filter('widget_text','ejecutar_php',100); | |
Ejemplo | |
<a href="https://plus.google.com/share?url=<?php the_permalink() ?>" target="_blank" title="Compartir en googleplus "><i class="zocial-googleplus" style="color:#52a0af; font-size:28px;"></i></a> | |
<a href="http://twitter.com/home?status=<?php the_permalink() ?>" target="_blank" title="Compartir en twitter "><i class="zocial-twitter" style="color:#52a0af; font-size:28px;"></i></a> | |
<a href="http://facebook.com/sharer.php?u=<?php the_permalink() ?>" target="_blank" title="Compartir en facebook " ><i class="zocial-facebook" style="color:#52a0af; font-size:28px;"></i></a> | |
<a href="http://pinterest.com/pin/create/button/?url=<?php the_permalink() ?>" target="_blank" title="Compartir en pinterest" ><i class="zocial-pinterest" style="color:#52a0af; font-size:28px;"></i></a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment