Trying to remove the image from the function previous_image_link () directly through the arguments of this function I do this is not possible. Therefore, try to simply extract the SRC:
<td style="background: url(
<?php
$html = previous_image_link('full');
preg_match_all('/<img [^>]*src=["|\']([^"|\']+)/i', $html, $matches);
foreach ($matches[1] as $key=>$value) {
echo $value;
}
?>
) no-repeat center center; background-size: cover;">
However, instead of the expected
<td style="background: url(/wp-content/uploads/2015/03/tiaurus.info_20150323125918.jpg") no-repeat center center; background-size: cover;">
getting
<td height="3166" class="attachment-full" alt="img_alt_text" src="/wp-content/blablabla/20150323125918.jpg" 8176"="">) no-repeat center center;background-size: cover;">
</td>
) no-repeat center center;background-size: cover;">
As in my case it is necessary to use preg_match_all?
Or can someone tell me how to get the SRC previous and next images for use in image.php?
Aucun commentaire:
Enregistrer un commentaire