Answer the question
In order to leave comments, you need to log in
WordPress. How to properly implement a custom news section with multilingualism?
Hello. There is a multilingual site on Wordpress (multilingualism implemented using polylang). There are a number of elements on the site that are planned to be changed/added/removed from time to time.
For example, available vacancies. All of them are available on the "Jobs" page, in the footer of the site.
The question is how to properly implement the admin part to interact with these vacancies? So that an inexperienced user entering the admin panel can easily add / edit existing vacancies, taking into account multilingualism (so that he does not have to declare new variables in polylang every time). That is, something as close as possible to standard records.
Answer the question
In order to leave comments, you need to log in
You simply create a custom post type that will be available in the admin panel as a separate section, just like "posts" or "pages". This can be done both through plugins and by inserting code into functions.php:
// регистрируем тип записей Вакансии
function register_vacancy_entities() {
$vacancy_args = array(
'public' => true,
'label' => null,
'labels' => array(
'name' => 'Вакансии',
'singular_name' => 'Вакансия',
'add_new' => 'Добавить вакансию',
'add_new_item' => 'Добавление вакансии',
'edit_item' => 'Редактирование вакансии',
'new_item' => 'Новая вакансия',
'view_item' => 'Смотреть страницу вакансии',
'search_items' => 'Искать вакансии',
'not_found' => 'Не найдено',
'not_found_in_trash' => 'Не найдено в корзине',
'parent_item_colon' => '',
'menu_name' => 'Вакансии',
),
'menu_position' => 5,
'menu_icon' => 'dashicons-admin-users',
'rewrite' => array( 'slug' => 'vacancy' ),
'has_archive' => true
);
register_post_type( 'vacancy', $vacancy_args );
}
add_action( 'init', 'register_vacancy_entities' );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question