• Greetings,
    I created a custom multiple images field with Pods that shows on a post-type edit page.
    These custom images are attachements to the POST.
    This means I need a custom query so that the images shown are the ones from the current POST. I can’t do that via a custom query because we can’t get the current POST ID.

    Is there a way to extend settings from a saved layout, with PHP, so that I can edit the custom query and fill it with the right parent ID ? I tried using the filters but I can’t seem the modify the custom query, only get data : https://visualportfolio.co/documentation/developers/wordpress-filters/

    Any idea how to do this ? Thank you a lot, I love this plugin !

    • This topic was modified 5 years, 11 months ago by nardoum.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter nardoum

    (@nardoum)

    Edit : I guess my question is : how to set the custom query via PHP ?

    Thread Starter nardoum

    (@nardoum)

    Just un update: I was able to modify the custom query by using :
    vpf_extend_query_args (with params $items,$options)

    Then you modify $items and add whatever you want, I for example added a post_in array with the attachments I retrieved in a previous code :

    
    $items['post_status'] = 'inherit';
    $items['post_mime_type'] = 'image';
    $items['post__in'] = $attachments_ids;
    

    Only problem is it will affect every layout and even in the backend, maybe a glitch here ?

    • This reply was modified 5 years, 11 months ago by nardoum.
    Plugin Author nK

    (@nko)

    Hi.

    vpf_extend_query_args filter works for all layouts, in the frontend, and in backend preview. You need to somehow determine which layout exactly you want to filter. In the $options you can find the layout ID.

    Regards, nK.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How to extend settings ?’ is closed to new replies.