P
P
Patimat Kamutayeva2021-08-22 21:48:11
WordPress
Patimat Kamutayeva, 2021-08-22 21:48:11

Why are post images not showing up in Wordpress?

Post images are no longer displayed. Custom fields don't work. Previously, it was enough to write in the functions file, for example, the following code:

function product(){
?>
<div class="product">
  <a href="<?php the_permalink();?>" class="product_top">
    <div class="product_title"><?php the_title(); ?></div>
    <div class="product_image" style='background: url(<?php echo get_field('фото')['sizes']['medium'];?>) no-repeat center center/cover;'></div>
  </a>
</div>


And now the record appears, but there is no image.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Zolin, 2021-08-23
@artzolin

There can be many hypotheses, for example:

  • You have not added any images
  • Something with ACF
  • Array ['sizes'] has no value 'medium'
  • .product_image has no styles set, so image height is 0

You need to debug: first make sure that the necessary link to the image is displayed in url(), then look at the height of the element in css

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question