Answer the question
In order to leave comments, you need to log in
Not writing data to a WordPress variable?
while( have_posts() ) : the_post();
$html = '
<a href="'.the_permalink().'" class="post-item__photo">
<img src="'.the_post_thumbnail_url().'" alt="">
</a>
<a href="'.the_permalink().'" class="post-item__title">'.the_title().'</a>
<p></p>
<a href="'.the_permalink().'" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
';
$array[] = $html;
endwhile;
print_r($array);
(
[0] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
[1] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
[2] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
[3] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
[4] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
[5] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
[6] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
[7] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
[8] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
[9] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
[10] =>
<a href="" class="post-item__photo">
<img src="" alt="">
</a>
<a href="" class="post-item__title"></a>
<p></p>
<a href="" class="post-item__link">
<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42.9546 9.79777V40.4852H32.6078V21.113V18.6988L30.9007 20.4059L8.76622 42.5403L1.41421 35.1883L23.5487 13.0539L25.2558 11.3468H22.8416L3.46936 11.3468L3.46936 1L34.1568 1L42.9546 9.79777Z" stroke="black" stroke-width="2"/></svg>
</a>
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question