forked from umarmughal/ionMag
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloop-attachment.php
More file actions
46 lines (29 loc) · 1.14 KB
/
Copy pathloop-attachment.php
File metadata and controls
46 lines (29 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
$td_att_url = '';
$td_att_alt = '';
if (have_posts()) {
while ( have_posts() ) : the_post();
if ( wp_attachment_is_image( $post->id ) ) {
$td_att_image = wp_get_attachment_image_src( $post->id, 'full');
if (!empty($td_att_image[0])) {
$td_att_url = $td_att_image[0];
}
if (empty($td_att_image[0])) {
$td_att_image[0] = ''; //init the variable to not have problems
}
$td_image_data = td_util::get_image_attachment_data($post->post_parent);
if (!empty($td_image_data->alt)) {
$td_att_alt = $td_image_data->alt;
}
?>
<a href="<?php echo wp_get_attachment_url($post->id); ?>" title="<?php the_title(); ?>" rel="attachment"><img class="td-attachment-page-image" src="<?php echo $td_att_image[0];?>" alt="<?php echo $td_att_alt ?>" /></a>
<div class="td-attachment-page-content">
<?php the_content(); ?>
</div>
<?php
}
endwhile; //end loop
} else {
//no posts
echo td_page_generator::no_posts();
}