July 2010
M T W T F S S
« Jun «-»  
 1234
567891011
12131415161718
19202122232425
262728293031  

Leaving Chris World?

Why not bring back a souvenir?

Archives

My First Wordpress Plugin

I did it. I wrote a word press plugin.
Now, I just need to study up a bit more and
write some database code. I can then create a web service
to parse using another program.

  1.  
  2. <?php
  3. /*
  4. Plugin Name: Only Your YOUR
  5. Plugin URI: http://www.welcometochrisworld.com/THEPOSTFORYOUR
  6. Description: This plugin replaces all occurrences of 'you're' with 'your' and
  7. places a link around 'your' explaining why I would do such a thing...
  8. I was tired of people correcting my use of the word you're.
  9. So, I decided I would never use the word again!"
  10. Version: 0.1
  11. Author: Chris Stones
  12. Author URI: http://www.welcometochrisworld.com/
  13. */
  14. // wp-content/plugins only_use_your_plugin.php
  15.  
  16. function only_use_your($text) {
  17. $your_link = "<a href=\"\">your</a>";
  18. $cap_your_link = "<a href=\"\">Your</a>";
  19. $text = str_replace("you're",'your',$text);
  20. $text = str_replace("You're",'Your',$text);
  21. $text = str_replace('Your',$cap_your_link,$text);
  22. $text = str_replace('your',$your_link,$text);
  23. return $text;
  24. }
  25.  
  26. add_filter('the_content','only_use_your');
  27. ?>
  28.  


"If there was ever a language that could help you to write
programs for a Quantum computer. Lisp would be it."

1 comment to My First Wordpress Plugin

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Security Code: