[wp-hackers] basic bilingual plugin: need help with two issues
Stephanie Booth
bunnylists at gmail.com
Sun Apr 12 08:02:38 GMT 2009
Hello hackers!
I'm taking advantage of the Easter break to brush up some of my poor
plugins, in particular Basic Bilingual.
You can find it here: http://wordpress.org/extend/plugins/basic-bilingual
I'm stuck with two problems:
1. language selection field
Language is stored as postmeta, and I have added a clumsy field to the
admin interface to allow editing it more easily. I'd like to make this
field less clumsy, place it higher up in the post/edit page, and
change it into radio buttons. Radio buttons I can probably figure out
for myself (though I'm very rusty and it'll probably take me half a
day), but I'm really stuck trying to integrate this form element more
smoothly with the rest of the post/page editing form.
2. adding lang="" attribute to the post/hentry div
I'd like the plugin to automatically add the correct lang attribute to
the div containing the post. I've got some code but I'm a bit stuck,
again:
function bb_embed_lang($buffer) {
ob_start('bb_insert_lang_attribute');
}
function bb_insert_lang_attribute($buffer) {
$search='/(class="(.)*hentry(.)*")/';
$replace=\\1 . ' lang="' . bb_get_the_language() . '"';
return preg_replace($search, $replace, $buffer);
}
function bb_got_hentry()
{
// needs to check for hentry presence
return false;
}
if(bb_got_hentry())
{ add_action('template_redirect', 'bb_embed_lang');
}
Of course, if you have any other comments or suggestions for my code,
I'm a taker (I'm a dabbler much more than a coder, and this plugin was
written for a way older version of WordPress, initially).
Thanks a lot for any help
Steph
--
Espace Coworking Lausanne: http://eclau.ch
Subscribe to my newsletter: http://groups.google.com/group/sbooth
web: http://stephanie-booth.com | blog: http://climbtothestars.org
skype: steph-booth | cell: +41 78 625 44 74 | twitter: stephtara |
AIM: Gummywabbit
geotag: Lausanne, Switzerland (GMT+1) | For the rest... Google me!
More information about the wp-hackers
mailing list