• Resolved jimwright2

    (@jimwright2)


    Hello all. I’m developing my first WP theme, I’m towards the tail end of where I’d like it to be and am running it through the Theme Checker, I’m not sure how to get around this particular warning:

    WARNING: More than one text-domain is being used in this theme. This means the theme will not be compatible with www.remarpro.com language packs. The domains found are MT, serif, sansserif, display.

    I have traced the issue to a control that I’m creating, here’s a clip of the code for the serif domain it’s finding:

    $wp_customize->add_setting('font_comment2',
    array(
       'default' => true,
       'transport' => 'refresh',
       'sanitize_callback' => 'sanitize_text_field',
    )
    );
    $wp_customize->add_control(
    new MT_comment($wp_customize, 'font_comment2',
    array(
       'label' => __( 'Popular Serif Fonts' .MT_showFonts($theFontsList['serif']), 'MT' ),
       'section' => 'font_family-settings',
    )
    )
    );

    For the above, the MT_Comment code is as follows:

    class MT_Comment extends WP_Customize_Control {
    public function render_content() {
        ?>
        <h3 class='' style="color: #50575e;margin: 0px;"><?php echo $this->label; ?></h3>
        <?php }
    }

    I have two additional functions which instead of serif have sansserif and display used. The functions work as intended, but are just failing on the Theme Checker, and I’m not sure how to massage these to get around this warning.

    And before anyone calls it out, I’ve already figured out that my uppercase theme name is causing a problem, I just haven’t had time yet to do a global search/replace to fix that.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jimwright2

    (@jimwright2)

    Answering my own question… I just had to lay the control out slightly differently to fix this.

    $wp_customize->add_control(
        new MT_comment($wp_customize, 'font_comment2',
        array(
            'label'       => __( 'Popular Serif Fonts
    ', 'MT' ) . MT_showFonts($theFontsList['serif']),
            'section'     => 'font_family-settings',
            )
        )
    );
    • This reply was modified 1 year, 11 months ago by jimwright2.
    Moderator bcworkz

    (@bcworkz)

    You probably realize now why translation functions need be that way, but for anyone else reading this who are still not sure why it makes a difference; the first arg in a translation function must be a simple string. You cannot have variables or expressions that resolve to a string value, it has to be a simple string. If you include variables or expressions, not only does it confuse the theme checker, it confuses the gettext parser as well. Meaning your strings will not be properly translated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Theme checker reports multiple text-domains’ is closed to new replies.