Found on the Internet a solution how to superimpose the text on the picture. That's just to "Read more" I would like to add more php code to display the date.

.imgteaser { /* общий блок */ position: relative; display: table; margin: 0 auto; color: rgba(255, 255, 255, 0.95); cursor: pointer; } .imgteaser:after { /* "подробнее" */ content: "Подробнее"; position: absolute; right: 0px; left: 0px; bottom: -6px; padding: 5px 9px 4px 9px; background: rgba(0, 0, 0, 0.2); } .imgteaser:hover:after {content: none;} .imgteaser figcaption {display: none;} .imgteaser:hover figcaption { /* прозрачная область */ display: block; position: absolute; right: 0px; left: 0px; bottom: -6px; padding: 5px 9px 4px 9px; background: rgba(0, 0, 0, 0.8); -webkit-box-shadow: 0 0 15px 0 rgba(255, 255, 255, 1); box-shadow: 0 0 15px 0 rgba(255, 255, 255, 1); } 

-

 <div class="miniature"> <?php if ( has_post_thumbnail()) { ?> <figure class="imgteaser"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" > <?php the_post_thumbnail('post-thumbnail'); ?></a> <figcaption>прозрачная область</figcaption> </figure> <?php } ?> </div> 
  • I'm talking about "content:" Read more ";" not php - Yupi
  • >>> This is just a "Details" I would like to add more php code to display the date. php code to display the date - copist
  • "Details" is registered in css, php does not zaphnut there. so I ask for an alternative. - Yupi
  • Come up with any garbage, then knead. Well, why the date in the "more" line, what is the meaning of it? - copist

1 answer 1

You can dodge like this:

 <?php # Условие формирования текста для блока "Подробнее" взято с потолка... $more = "Подробнее" . ($date ? " {$date}" : ""); # Ниже подключаем инлайновые-стили, чтобы изменить значение css-свойства 'content' ?> <style type="text/css"> .imgteaser:after { /* "подробнее" */ content: "<?php echo $more; ?>"; } </style> <div class="miniature"> <?php if ( has_post_thumbnail()) { ?> <figure class="imgteaser"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" > <?php the_post_thumbnail('post-thumbnail'); ?></a> <figcaption>прозрачная область</figcaption> </figure> <?php } ?> </div> 
  • Just do not use short tags <? =?> For they will be cut out soon, this time, and the second - they may not work under different server settings. - kemerov4anin
  • kemerov4anin, well, write your own example without short tags - copist
  • one
    @ kemerov4anin, replaced the output. - VenZell