Archive for the "WordPress Snippet" Tag

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 your [...] → 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 you [...] → 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 : PLAIN TEXT PHP: <?php /* Plugin Name: Example: Add Meta Box Plugin URI: # Description: Simple example showing how to add a "meta box" in WP 2.5 Version: 0.0 Author: Ozh Author URI: http://planetozh.com/blog/ */   // This function tells WP [...] → Read more

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 change the posts_per_page parameter, and add Next and Previous [...] → Read more

Filed in: , ,
Posted On: 2008 / 02 / 11

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

Close
E-mail It