Forums

Retriving post attachments (3 posts)

  1. AndreaFiore
    Member
    Posted 3 years ago #

    Hi all,
    I am using Wordpress for a client's website.
    I was wandering if is there some easy way to access to all the files names attached to a post from the code running in a page template

    Thank you in advance, I hope this makes sense
    Andrea

  2. AndreaFiore
    Member
    Posted 3 years ago #

    well... If for sombody can be interesting,I solved the problem by using the wpdb object (http://codex.wordpress.org/Function_Reference/wpdb_Class)
    This works even in a template!

    Here is the code I used

    $my_query = "select guid from wp_posts where (post_parent=$post-ID and (post_mime_type='image/gif') OR (post_mime_type='image/png') OR (post_mime_type='image/jpg')";
    $res = $wpdb->get_row($my_query,ARRAY_A);

  3. kulpreetsingh
    Member
    Posted 2 years ago #

    Andrea,

    What do you do beyond this?

Topic Closed

This topic has been closed to new replies.

About this Topic