最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

child theme - bbpress change the word forum, topic, reply in the forum to another word I choose

programmeradmin1浏览0评论

bbpress

I would want to customize my Forum in bbpress. by changing/replacing the words that appear on the forum layout. I would like to change the words (everywhere they appear): Forum, topic, reply. To other words of my choice.

Does anyone have any way of doing this? I think I will need to make a child theme? anyone have any experience with such a problem?

Does anyone know what files name to edit for theme twenty eleven. and where they files are located?

bbpress

I would want to customize my Forum in bbpress. by changing/replacing the words that appear on the forum layout. I would like to change the words (everywhere they appear): Forum, topic, reply. To other words of my choice.

Does anyone have any way of doing this? I think I will need to make a child theme? anyone have any experience with such a problem?

Does anyone know what files name to edit for theme twenty eleven. and where they files are located?

Share Improve this question edited Nov 3, 2012 at 11:24 user20509 asked Nov 1, 2012 at 6:19 user20509user20509 135 bronze badges 5
  • What have you tried to do already? Have you looked at bbPress's child theme located in the plugin's folder? There you will find most your answers in regards to changing the forum template, style and custom wording. – Nicole Commented Nov 1, 2012 at 12:57
  • I would like to clarify is there a child theme already made or do I have to make one? and where do I find the forum template? what's the file called? – user20509 Commented Nov 2, 2012 at 6:47
  • Hi nicole, I have created a child theme... but I don't know where the forum template is? Is there a file where I can change the forum variable, topic variable, to other words of my choice? – user20509 Commented Nov 2, 2012 at 8:34
  • You have to make the theme. However you can find the reference files inside the plugins folder. – Nicole Commented Nov 2, 2012 at 12:54
  • do you by any chance know the name of the file? what am I looking for? what are the reference files? is there more than one file I need to edit? – user20509 Commented Nov 2, 2012 at 13:01
Add a comment  | 

1 Answer 1

Reset to default 3

You can hook to translation filters of Wordpress to change any word or phrase. These filters are: gettext, ngettext and gettext_with_context:

add_filter('gettext', 'change_bbpress_wording', 10, 3);
add_filter('ngettext', 'change_bbpress_wording', 10, 3);
add_filter('gettext_with_context', 'change_bbpress_wording', 10, 3);

function change_bbpress_wording ($translated, $untranslated, $domain) {

    if ($domain == 'bbpress') {

        $translated = str_ireplace('Forum', '*desired word*', $translated );
        $translated = str_ireplace('Topic', '*desired word*', $translated );
        $translated = str_ireplace('Reply', '*desired word*', $translated );

    }

    return $translated;
}

Note that we use str_ireplace which is case-insensitive, for case-sensitive replacement use str_replace instead.

See gettext filter hook codex page for more examples.

发布评论

评论列表(0)

  1. 暂无评论