WordPress.org

Support

Support » How-To and Troubleshooting » Get the url of attachments from the database ?

Get the url of attachments from the database ?

  • I used the following code to get the images posted in a post

    $current_id = get_the_ID();
    $rows = $wpdb->get_results("select guid from $wpdb->posts where post_parent = $current_id");
    
    foreach ($rows as $row) {
    
    ?>
    
    <a>guid; ?>" data-titan-lightbox="on" data-titan-group="<?php the_ID() ?>"  style="display: none"><img src="<?php echo $row->guid; ?>" alt="Caption" class="Thumbnail thumbnail " width="228" height="160"></a>
    
    <?php

    but this code give the images path with the folder containing the images

    How can i get only the image from this loop ?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get the url of attachments from the database ?’ is closed to new replies.