[wp-hackers] Back on the plugin scene -- some questions

Stephanie Booth bunnylists at gmail.com
Sat Dec 29 10:53:21 GMT 2007

Hi folks,

I'm back in the WordPress plugin hacking world, with a few questions.

1. Print CSS

I noticed that WP does not provide a print stylesheet out of the box
(I thought it used to, but I may remember incorrectly -- depends on
the theme, I guess). Anyway, I started looking around for existing
plugins to add a print stylesheet before writing my own. I found WP
Print <http://wordpress.org/extend/plugins/wp-print/> but it adds a
print link and seems a bit heavy. All I want is basically to insert
<link rel="stylesheet" type="text/css" href="/blah/print.css"
media="print" title="Normal" /> in the header and provide a CSS file.
So, sub-questions:

- is there a plugin I missed that does roughly what I want?
- does anybody know of pre-existing print stylesheets for the Sandbox theme?
- I see a few filters containing the word "stylesheet" here
but honestly, what they do seems a bit fuzzy according to the
description (I'm not very knowledgable in how WP deals with
stylesheets); what would the best way be to insert my line of HTML in
the header -- assuming that editing the template manually is not an

2. Is feed or not?

As described in this post
I've modified the Similar Posts plugin to automatically add the
similar posts links. I want them at the beginning of the content in
the blog, but at the end of the post content in the feed. So, I wrote
two different functions for that and then used this code for the

if(is_feed()) {
	add_action('the_content', 'sp_embed_feed_similar_posts');
	add_action('the_content', 'sp_embed_similar_posts');

Unfortunately, this doesn't seem to work. In the feed, the similar
posts are placed like in the main blog page, which means the second
function was used. What am I missing here?

3. Sandbox drop-down menu problem in IE/win

This isn't exactly a plugin problem. The drop-down menus in the
sandbox theme down behave correctly in IE/win -- they drop /next/ to
the parent menu, instead of /under/ it, making access to the next item
on the menu bar impossible.

- has anybody already solved this problem?
- is this the right place to try to find help for this?

4. Using ob_start()

I've been told this could be a bit nasty, but it seems a solution for
my Basic Bilingual plugin (updated last night in the plugin
repository, btw!), which I would like to make capable of inserting
lang="xx" attributes in various pre-existing elements in templates.

Can somebody tell me if I'm on the right track with the following:

function bb_replace($buffer) {
	$search = blah blah
        $replace = blah blih bloh
	return preg_replace($search, $replace, $buffer);

function bb_buffer() {

add_action('template_redirect', 'bb_buffer'); // is this the correct
hook to use?

I guess I could also use this method to add my stylesheet link
(problem #1 above) but I guess there is a more elegant solution for

Thanks a lot for your help -- feels nice to be "coding" again!

Steph aka bunnywabbit_
web: http://stephanie-booth.com
blog: http://climbtothestars.org
skype: steph-booth or +41 44 586 42 74 | cell: +41 78 625 44 74
ICQ: 23836265 | MSN: gummywabbit at hotmail.com | AIM: Gummywabbit
For the rest... Google me!

More information about the wp-hackers mailing list