Posted By

Scoldy on 05/09/13


Tagged

variable with follow Wordperss


Versions (?)

Wordperss Follow with variable


 / Published in: PHP
 

Wordperss Follow with variable In double quotes you have ability to embed variable post content: [twitter username='VeronicaDjeneva']Follow me Fools[/twitter]

  1. <?php
  2. /*
  3. Plugin Name: Twitter Shower
  4. Plugin URI: http://www.scoldy.com
  5. Discription: Simple shortcode
  6. Version: 1.0
  7. Author: Ronnie
  8. Author URI: http://www.scoldy.com
  9. */
  10.  
  11. add_shortcode('twitter', function($atts,$content) {
  12. $atts = shortcode_atts(
  13. 'username' => 'VeronicaDjeneva',
  14. 'content' => !empty($content)? $content : 'Follow me on Twitter!'
  15. ),$atts
  16. );
  17. extract($atts);
  18.  
  19. return "<a href='http://twitter.com/$username'>$content</a>";
  20. });
  21.  
  22. ?>

Report this snippet  

You need to login to post a comment.