最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - _load_textdomain_just_in_time

matteradmin10PV0评论

Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the anona domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. (This message was added in version 6.7.0.)

_load_textdomain_just_in_time()
wp-includes/l10n.php:1371
get_translations_for_domain()
wp-includes/l10n.php:1409
translate()
wp-includes/l10n.php:195
__()
wp-includes/l10n.php:307
ATP_Theme->atp_themesupport()
wp-content/themes/anona/functions.php:225
ATP_Theme->__construct()
wp-content/themes/anona/functions.php:157

the lines of code it says is


function atp_themesupport()
{
    add_theme_support('post-formats', array(
        'aside',
        'audio',
        'link',
        'image',
        'gallery',
        'quote',
        'status',
        'video',
        'event'
    ));
    add_theme_support( 'post-thumbnails' );
    add_theme_support( 'automatic-feed-links' );
    add_theme_support( 'editor-style' );
    add_theme_support( 'title-tag' );

    /**
     * register menu.
     */
    register_nav_menus( array(
        'primary-menu' =>__( 'Primary Menu', 'anona' )
    ));


    /**
     * define content width.
     */
    if (!isset( $content_width ))
        $content_width = 1100;
}

class ATP_Theme
{
    public $theme_name;
    public $meta_box;

    public function __construct()
    {
        $this->atp_constant();
        $this->atp_themesupport();
        $this->atp_head();
        $this->atp_themepanel();
        $this->atp_widgets();
        $this->atp_custom_meta();
        $this->atp_meta_generators();
        $this->atp_common();
    }
if (!function_exists('atp_theme_setup')) {

    add_action('after_setup_theme', 'atp_theme_setup');

    function atp_theme_setup()
    {
        load_theme_textdomain('anona', get_template_directory() . '/languages');
        add_filter('the_content', 'pre_process_shortcode');
        add_filter('widget_text', 'do_shortcode');
        add_filter('posts_where', 'multi_tax_terms');
        add_filter('wp_trim_excerpt', 'new_excerpt_more');
        add_filter('upload_mimes', 'atp_custom_upload_mimes');
        // This theme uses its own gallery styles.
        add_filter( 'use_default_gallery_style', '__return_false' );
    }
}

can you please help me ? thanks a lot

Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the anona domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. (This message was added in version 6.7.0.)

_load_textdomain_just_in_time()
wp-includes/l10n.php:1371
get_translations_for_domain()
wp-includes/l10n.php:1409
translate()
wp-includes/l10n.php:195
__()
wp-includes/l10n.php:307
ATP_Theme->atp_themesupport()
wp-content/themes/anona/functions.php:225
ATP_Theme->__construct()
wp-content/themes/anona/functions.php:157

the lines of code it says is


function atp_themesupport()
{
    add_theme_support('post-formats', array(
        'aside',
        'audio',
        'link',
        'image',
        'gallery',
        'quote',
        'status',
        'video',
        'event'
    ));
    add_theme_support( 'post-thumbnails' );
    add_theme_support( 'automatic-feed-links' );
    add_theme_support( 'editor-style' );
    add_theme_support( 'title-tag' );

    /**
     * register menu.
     */
    register_nav_menus( array(
        'primary-menu' =>__( 'Primary Menu', 'anona' )
    ));


    /**
     * define content width.
     */
    if (!isset( $content_width ))
        $content_width = 1100;
}

class ATP_Theme
{
    public $theme_name;
    public $meta_box;

    public function __construct()
    {
        $this->atp_constant();
        $this->atp_themesupport();
        $this->atp_head();
        $this->atp_themepanel();
        $this->atp_widgets();
        $this->atp_custom_meta();
        $this->atp_meta_generators();
        $this->atp_common();
    }
if (!function_exists('atp_theme_setup')) {

    add_action('after_setup_theme', 'atp_theme_setup');

    function atp_theme_setup()
    {
        load_theme_textdomain('anona', get_template_directory() . '/languages');
        add_filter('the_content', 'pre_process_shortcode');
        add_filter('widget_text', 'do_shortcode');
        add_filter('posts_where', 'multi_tax_terms');
        add_filter('wp_trim_excerpt', 'new_excerpt_more');
        add_filter('upload_mimes', 'atp_custom_upload_mimes');
        // This theme uses its own gallery styles.
        add_filter( 'use_default_gallery_style', '__return_false' );
    }
}

can you please help me ? thanks a lot

Share Improve this question edited Apr 19 at 17:11 mmm 3,8893 gold badges16 silver badges22 bronze badges asked Apr 19 at 14:12 insect trojaninsect trojan 11 silver badge4 bronze badges 2
  • 1 it looks you instantiate ATP_Theme too early. try to do it in the function atp_theme_setup. look the documentation of the function add_theme_support – mmm Commented Apr 19 at 17:15
  • thanks a lot i did the code down and i think it is ok – insect trojan Commented Apr 20 at 5:46
Add a comment  | 

1 Answer 1

Reset to default 0
$shortname = 'atp';

add_action('after_setup_theme', 'atp_theme_setup'); define('PSTCTRL_DIR', get_template_directory() . '/pest-control/');

if (!defined('PESTCONTROL_DIR')) { define('PESTCONTROL_DIR', get_template_directory() . '/pest-control/'); }

// Modified theme initialization add_action('after_setup_theme', function() { global $atp_theme, $url;

if (defined('PESTCONTROL_DIR') && file_exists(PESTCONTROL_DIR . 'index.php')) {
    require_once(PESTCONTROL_DIR . 'index.php');
} else {
    $atp_theme = new ATP_Theme();
    $url = FRAMEWORK_URI . 'admin/images/';
}

}, 5);

if( !function_exists('atp_theme_setup') ){ function atp_theme_setup(){ load_theme_textdomain('anona', get_template_directory() . '/languages'); add_filter('the_content', 'pre_process_shortcode'); add_filter('widget_text', 'do_shortcode'); add_filter('posts_where', 'multi_tax_terms'); add_filter('wp_trim_excerpt', 'new_excerpt_more'); add_filter('upload_mimes', 'atp_custom_upload_mimes'); // This theme uses its own gallery styles. add_filter( 'use_default_gallery_style', '__return_false' ); } }

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far