Archive for the "WordPress Snippet" Tag

Filed in: , ,
Posted On: 2009 / 08 / 16

Making HTTP requests in PHP is not difficult, and a variety of methods exists: using fopen(), using cURL extension, using file streams with fsockopen() and fwrite() for instance. The problem is: depending on server setup, this might or might not work on another server. The good new is: once again, WordPress has a no-brainer API […][...] → Read more

Filed in: , ,
Posted On: 2008 / 04 / 15

Go to your blog admin area, head to the "Write" page, move your mouse over the "Add media" tiny icons: you probably had noticed it already, WordPress 2.5 comes with a neat tooltip function. Using it in your own plugins is so easy that a hamster could do it. First, in the HTML output of […][...] → Read more

Adding javascript into an admin page is a critical part of plugin coding. Critical, because it is both trivial and probably reason #1 why it will conflict with other plugins if not done properly. When their plugin needs javascript, Good Plugin Coders™ have to make sure of the following points: add javascript only once: if […][...] → Read more

To add custom content to the "Write" admin pages (where you write posts, pages or links), WordPress 2.5 introduces a new function set: add_meta_box() Simple plugin example : < View plain text > php <?php /* Plugin Name: Example: Add Meta Box Plugin URI: # Description: Simple example showing how to add a "meta box" […][...] → Read more

< View plain text > php query_posts($query_string.'posts_per_page=-1');        while(have_posts()) {        the_post();        the_time();        the_title(); } This will display the time and title for all your posts. This could result in a very long page, and a more usable way of doing it would be to […][...] → Read more

I'm a reader of the wp-hackers mailing list. Besides some fairly useless and unproductive advocacy or opinion threads happening on an annoyingly regular basis, the list is also a very great place to share code tips and snippets. Someone asks a "how do I do this" question, and someone else (sometimes) comes up with a […][...] → Read more