Y
Y
Yuri Kirillov2017-02-27 17:01:36
Images
Yuri Kirillov, 2017-02-27 17:01:36

Displaying attached photos/images of a post in Wordpress?

It would be desirable to make a cycle of an output of the photos uploaded by users (!) to a certain record. But so that the attached administrator photos are not displayed, because. used within the entry itself.
I found this code that displays attached pictures, but everything is displayed there. Can I make a condition for uploading to the site from the level of the user rights role (the photo was marked) or manually put 1/0 in an arbitrary field (then how to do it and check it when outputting)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2017-02-27
@kirilloff-iura

// Начальные параметры выборки.
    $CurrentThumb = array(
        'post_status'    => inherit,
        'post_type'      => 'attachment', // Тип: аттач.
        'post_parent'    => get_the_ID(), // Родительский постовой.
        'author__not_in' => array( '1', ), // массив ID юзеров, которых не учитывать (админов)
        'post_mime_type' => 'image', // Картинка.
        'order'          => 'ASC' // Сортировка ASC или DESC?
    );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question