Answer the question
In order to leave comments, you need to log in
How to implement adding photos to the slider?
Hello guys!
It is necessary to implement the function of adding photos through the admin panel, I created a new type of pages
In the functions.php file, I wrote:
add_action('init', function(){
register_post_type('faq',array(
'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' => 'ЧАВО',
),
'public' => false,
'show_ui' => true,
'menu_position' => null,
'menu_icon' => null,
'hierarchical' => false,
'supports' => [ 'editor' ],
) );
});
function getPhoto(){
$args = array(
'orderby' => 'date',
'order' => 'ASC',
'post_type' => 'faq',
);
return get_posts($args);
}
<div class="silk_inner">
<?php foreach(getPhoto() as $post): ?>
<div class="slide_img"> <?php echo $post -> post_editor; ?> </div>
<?php endforeach; ?>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question