Answer the question
In order to leave comments, you need to log in
How to put an image inside the wordpress loop?
Hello! There is a standard loop in wordpress . Interested in how it is inside the standard announcement cycle (limit of 7 articles)
<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
<li>
<span class="li--span"><span class="li--span--category"><?php the_category( ', ' ); ?></span></span>
<a href="<?php the_permalink() ?>" class="li--a">
<span class="little_content"><?php the_title(); ?></span>
</a>
</li>
<?php endwhile; ?>
<a href="#"><img src="<?php echo get_template_directory_uri() ?>/img/advertisement.jpg" width="300" height="500" title="Перейти на сайт рекламодателя" /></a>
Answer the question
In order to leave comments, you need to log in
<?php $i = 1; if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
<li>
<span class="li--span"><span class="li--span--category"><?php the_category( ', ' ); ?></span></span>
<a href="<?php the_permalink() ?>" class="li--a">
<span class="little_content"><?php the_title(); ?></span>
</a>
</li>
<?php if ( $i == 4 ) { echo 'картинка'; } ?>">
<?php $i++; endwhile; ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question