You can use this function for wordpress
<?php wp_get_attachment_image( $attachment_id, $size, $icon, $attr ); ?>
or
<?php wp_get_attachment_metadata( $attachment_id, $unfiltered ); ?>
Here is the codex
https://codex.wordpress.org/Function_Reference/wp_get_attachment_image
https://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata
With this u can get the name of the image and show like the Sagar said
You'll use this in your page, not in yout functions.php
U won't be this in the functions, you'll use this in your page, like this
<?php
$my_query = new WP_Query('post_type=eventos&category_name=galeria_evento&posts_per_page=1');
while ($my_query->have_posts()) : $my_query->the_post();
?>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'attachment',
'post_parent' => $post->ID,
'numberposts' => -1,
'paged' => get_query_var('paged'),
'exclude' => get_post_thumbnail_id()
);
// making the list of the attachments
$attachments = get_posts( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
// getting the image and title of the attachment
echo "<div class='item-slide'><p class='title-slide'>".apply_filters( 'the_title', $attachment->post_title )."</p>".wp_get_attachment_image( $attachment->ID, 'full' )."</div>";
}
}
?>
<?php endwhile; ?>