Help with “text domain”, comments_form in WordPress theme

I’ve been plugging away at creating my own theme and am pretty much there, but ran the Theme Check plugin and had a few concerns/questions:

  1. Throughout the theme, wherever there is text, I’ve used _e( 'Import / Export' ); for example to help with translations. I’m getting this message though throughout: RECOMMENDED: Text domain problems in admin/options-backup.php. You have not included a text domain! I’ve tried to do some research about text domains, but am for some reason not putting thing together correctly.
  2. I’ve received warnings for add_custom_image_header and add_custom_background not being included, but I don’t necessarily have these things available anyway – is there a way to register these functions, but then take them away (to get rid of that warning)?
  3. One other item is *REQUIRED: Could not find comment_form.* But, in my theme, I am using comments_template() instead – should I just overlook this one? As a frame of reference, I built this off of rootstheme.com

Thanks for any and all help on this one – I hope these types of questions would be useful for others trying to create a clean, WordPress template.

Related posts

Leave a Reply

3 comments

    1. Well, it says you are not including text domain… well – because you are not including text domain. Obviously to fix it – you should include text domain. See I18n for theme and plugin developers in Codex.

    2. There is no point in adding extra code just to fake testing results. If you don’t need that functionality then just ignore the warning.

    3. If you are using comments_template() but don’t actually provide comment template in your theme that means that it fall backs to code in core, that is only retained for compatibility and is marked for removal in the future. This is not proper way to use it – you should implement proper comment template in your theme.

    For future – post such unrelated items as separate questions. They don’t make sense as single question.

  1. For people that come here looking for a more detailed explanation about the text domain issue instead of just “use a text domain”. Here’s how it works.

    Firstly, you have to tell WordPress where the language files should be put in your theme, and what the ‘theme slug‘ is (a unique identifier for your theme) like so:

    add_action('after_setup_theme', 'crucial_setup');
    
    function crucial_setup(){
        load_theme_textdomain('theme-slug', get_template_directory() . '/languages');
    }
    

    Then, where ever you translate text, put the theme-slug on the translation. Like this:

    'name' => __('Main Sidebar', 'theme-slug'),
    

    Naturally, ‘theme-slug’ should be replaced with the name of your theme, sans spaces and any strange characters.

    It took me ages to get to the bottom of this, the WordPress docs explain it quite poorly.