load_theme_textdomain использует WordPress тема, ребенок не работает со мной

У меня проблема, что я хочу загрузить текстовый домен, используя дочернюю тему .. Страница функций в дочерней теме содержит только следующий код.

<?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' );
}

и это часть кода родительской функции .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 документов.

0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector