[wp-hackers] Re: basic bilingual plugin: need help with two issues

Stephanie Booth bunnylists at gmail.com
Sat Apr 18 10:08:24 GMT 2009

Hi folks,

I'm coming again with this problem I sent in about a week ago (maybe
at a bad time, Easter). I'm unfortunately still stuck with these
issues and would really welcome some help. I think this is the right
mailing-list for this sort of thing, but if it isn't, feel free to
point it out.

Thanks in advance to the kind souls who will take a look at the issues below.

Have a nice week-end


On Sun, Apr 12, 2009 at 10:02 AM, Stephanie Booth <bunnylists at gmail.com> wrote:
> 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