Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
The image doesn’t shrink for me when I refresh. It just disappears because I assume it (or something preceding it) is loading first, then reappears.
I’m using the latest Chrome.
maybe i have to recall the loop in some other way?
Here is my single.php loop:
` <div class="five columns">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h3 class="series">
<?php the_title(); ?>
</h3>
<?php print_excerpt(5000); ?> </div>
<?php endwhile; endif; ?>
<div class="padding20" />
</div>
<div class="settimo">
<ul class="cornice">
<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'exclude' => get_post_thumbnail_id( $post->ID ),
'post_parent' => $post->ID
);
$attachments = get_posts( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
echo '<li>';
echo the_attachment_link( $attachment->ID, 'thumbnail', false );
echo '<p class="small-title">';
echo apply_filters( 'the_title', $attachment->post_title );
echo '</p></li>';
}
}
wp_reset_postdata(); ?>
</ul>
</div>`
i’ve tried to solve the problem fo a while but nothing happened.
If I take off the apply_filters command for displayng the title and write a simple string of characters the problem remain the same:
🙁
I solved the issue inserting the images in a div…
I publish the changed code so it could be useful for someone.
$attachments = get_posts( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
echo '
<li>';
echo '<div class="imagebox">';
echo the_attachment_link( $attachment->ID, 'thumbnail', false );
echo '</div>';
echo '<p class="small-title">';
echo apply_filters( 'the_title', $attachment->post_title );
echo '</p></li>
';
[Moderator note: Please post code between backticks]