使用wordpress主题子项的load_theme_textdomain无法与我一起使用

我有一个问题, 我想使用子主题加载textdomain。子主题中的功能页面仅包含以下代码。

< ?php add_action( 'after_setup_theme', 'poseidon_child_setup'); function poseidon_child_setup() {// Poseidon theme for translation load_child_theme_textdomain( 'poseidon-child', get_stylesheet_directory() . '/languages' ); }

【使用wordpress主题子项的load_theme_textdomain无法与我一起使用】这是父function.php的代码的一部分
if (!function_exists('poseidon_setup')) :/** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */ function poseidon_setup() {// Make theme available for translation. Translations can be filed in the /languages/ directory. load_theme_textdomain('poseidon', get_template_directory() . '/languages'); // Add default posts and comments RSS feed links to head. add_theme_support('automatic-feed-links'); // Let WordPress manage the document title. add_theme_support('title-tag'); // Enable support for Post Thumbnails on posts and pages. add_theme_support('post-thumbnails'); // Set detfault Post Thumbnail size. set_post_thumbnail_size(840, 560, true); // Register Navigation Menu. register_nav_menu('primary', esc_html__('Main Navigation', 'poseidon')); // Switch default core markup for search form, comment form, and comments to output valid HTML5. add_theme_support('html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', )); // Set up the WordPress core custom background feature. add_theme_support('custom-background', apply_filters('poseidon_custom_background_args', array('default-color' => 'ffffff'))); // Set up the WordPress core custom logo feature. add_theme_support('custom-logo', apply_filters('poseidon_custom_logo_args', array( 'height' => 50, 'width' => 250, 'flex-height' => true, 'flex-width' => true, ))); // Set up the WordPress core custom header feature. add_theme_support('custom-header', apply_filters('poseidon_custom_header_args', array( 'header-text' => false, 'width' => 2500, 'height' => 625, 'flex-height' => true, ))); // Add Theme Support for wooCommerce. add_theme_support('woocommerce'); // Add extra theme styling to the visual editor. add_editor_style(array('css/editor-style.css', poseidon_google_fonts_url())); // Add Theme Support for Selective Refresh in Customizer. add_theme_support('customize-selective-refresh-widgets'); } endif; add_action('after_setup_theme', 'poseidon_setup');

我希望能帮助我解决此问题, 并尝试挂钩其他一些函数, 但似乎也无法正常工作, 但是当我使用}或)或; 时;在子function.php中, 我得到一个错误, 这意味着子文件可执行文件中的function.php, 但是我不知道为什么其中没有任何作用。
子主题中的languages文件夹包含以下文件:
poseidon.pot ar.po ar.mo

#1你必须改用父母的文本域:
// Poseidon theme for translation load_child_theme_textdomain( 'poseidon', get_stylesheet_directory() . '/languages' );

请参阅wordpress文档。

    推荐阅读