• Resolved cduyvis

    (@cduyvis)


    Hi, I’ve used this plugin for a few weeks now and it’s wonderful – it’s so helpful to organize my media gallery so easily!

    It would be great if I could check whether a certain image (ideally queried by ID) is in certain folders so I can use it for some conditional statements in my PHP templates. I’m pretty sure that it’s possible, based on the API page and other support topics here, however most people seem to want it the other way around (getting images by folder) and I’m not enough of a programmer to figure out how to achieve my goal. Would you be able to point me in the right direction?

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Bruce

    (@ninjateamwp)

    Hi @cduyvis ,

    Thanks for using FileBird, though I am not sure about exactly what you hoped to achieve as you’ve explained, but I will share this with our developers to see what could be possible then feed you back soon.

    Kind regards,
    -Bruce-

    Plugin Support Bruce

    (@ninjateamwp)

    Hi @cduyvis ,

    Here is the code you could use for that function:

    $inFolder = $wpdb->get_var(“SELECT COUNT(*) FROM ” . $wpdb->prefix . “fbv_attachment_folder WHERE (folder_id = $your_folder_id AND attachment_id = $your_attachment_id)”);
    if ($inFolder) {
    // attachment is in the folder
    }

    Let me know if that helps.
    Thank you.

    Kind regards,
    -Bruce-

    Thread Starter cduyvis

    (@cduyvis)

    Works perfectly! Thanks so much – I really appreciate your help with this!

    Plugin Support Bruce

    (@ninjateamwp)

    Hi @cduyvis ,

    You are most welcome and could you please leave the plugin a 5 star ratings?

    Thank you ??

    Kind regards,
    -Bruce-

    Thread Starter cduyvis

    (@cduyvis)

    All done ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Check whether image is in specific folder’ is closed to new replies.