Answer the question
In order to leave comments, you need to log in
Show wp post icons on thumbnail?
Hello everyone, I'm struggling with the output of the post format on the thumbnail in the front-end.
For example: I set the post format when publishing an audio or video recording, and now I would like the icons of these formats to be displayed on the post thumbnail and it would not be bad to immediately display them in the post itself. I'd be grateful for a tip...
Answer the question
In order to leave comments, you need to log in
this function will return the post format
get_post_format()
https://codex.wordpress.org/%D0%A4%D0%BE%D1%80%D0%...
On the frontend, the icon itself can be displayed in different ways, depending on whether how thumbnails are displayed.
For example, if the image is displayed via the_post_thumbnail(), you can do this:
add icon in css like this:
.attachment-icon{
position:relative;
z-index:1;
}
.attachment-icon:before{
position:absolute;
top:0;
left:0;
width:10px;
height:10px;
z-index:2;
}
.attachment-audio:before{
content:'наушники';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question