I
I
ivan_kushchenko2015-10-02 09:06:06
CMS
ivan_kushchenko, 2015-10-02 09:06:06

If the news has a picture, then set a different style for the news?

How to set a different style for the news block if the news block has an image? Let's say we add news to the site through Wordpress without a picture, then just a title is displayed, a short description below, and a link to the full news. And if with a picture, then the title should be on top of the picture, a brief description below (behind the picture).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
littleguga, 2015-10-02
@ivan_kushchenko

By picture, you probably mean thumbnail.
In your theme's loop.php file, change the theme's output

if ( has_post_thumbnail() ) {
  the_post_thumbnail();
  //здесь выводим в нужном формате, если есть thumbnail
}
else {
  //здесь выводим в нужном формате, если нет thumbnail
}

To get url thumbnail wp_get_attachment_image_src

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question