How can the_excerpt (or equivalent) be called on a category description?

wp_html_excerpt($category->description, 25). Or you can create your own function. I’m using this: /** * Filters content based on specific parameters, and appends a “read more” link if needed. * Based on the “Advanced Excerpt” plugin by Bas van Doren – http://sparepencil.com/code/advanced-excerpt/ * * @since 1.0 * * @param string $content What to filter, defaults to … Read more

WP 3-way voting system: On to something! Please help!

Here’s a simple solution. Append the ratings to the end of the post content: add_filter(‘the_content’, ‘add_ratings_to_content’, 4); // remove ratings from excerpts add_filter(‘get_the_excerpt’, create_function(”, ‘remove_filter(“the_content”, “add_ratings_to_content”, 6); return;’), 5); function add_ratings_to_content($content){ global $post; if(is_single()) $content .= the_ratings($post->ID); return $content; } Displays the current rating: function get_current_rating($post_id){ $votes = get_option(“votes_{$post_id}”); // handle your rating format here … Read more

Custom Path for a Plugin

Well this one is tricky. function my_plugin_query_vars($vars) { // add mypluginname to the valid list of variables $new_vars = array(‘mypluginname’); $vars = $new_vars + $vars; return $vars; } add_filter(‘query_vars’, ‘my_plugin_query_vars’); this will tell WordPress to accepts GET variables with the name mypluginname. so now you can process requests like http://www.example.com?mypluginname=param1 We add an action on … Read more

What should I pass for $needed_dirs when calling _unzip_file_pclzip (aka PclZip)?

@Scott B I have not tested this script, taken from inlcudes/file.php -> line 559 _unzip_file_pclzip assumes WP_Filesystem() has already been called, so you need to set up global $wp_filesystem global $wp_filesystem; $needed_dirs = array(); $target = trailingslashit($target); // Determine any parent dir’s needed (of the upgrade directory) if ( ! $wp_filesystem->is_dir($target) ) { //Only do … Read more

best way to run a php script away from the template?

Hi @Mild Fuzz: Sounds like what you might be looking for is the template_redirect hook. If you add a function for that hook then you can output whatever you want and end with an exit; statement. add_action( ‘template_redirect’, ‘yoursite_template_redirect’ ); function yoursite_template_redirect() { if (isset($_GET[‘foo’]) && $_GET[‘foo’]==’bar’) { // Do whatever you want when $_GET[‘foo’]==’bar’ … Read more

Is there any way to pass messages from a script to a redirect target in a hidden fashion?

Hehe, got it meself, just a little too late, unfortunately, now i have to change half the stuff again… set_transient(), get_transient() and delete_transient() will be my friends Edit: More on this…i now realized that my wp_options table is full of _transient_xyz records, coming from WP itself. So that indicates that WP is using the db … Read more