T
T
Tupic1232020-06-17 06:13:04
Slick
Tupic123, 2020-06-17 06:13:04

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


To load content through the editor and unload it on the page, for this I wrote the following in html:

<div class="silk_inner">
                <?php foreach(getPhoto() as $post): ?>
                    <div class="slide_img"> <?php echo $post -> post_editor; ?> </div>
                <?php endforeach; ?>
</div>


But for some reason the images are not showing up.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question