Archived topic
featured image
11 replies · Started by Marcin on September 1, 2017
Hello!
I set the featured image size to 353x235, but on mobile it looks bad.
It is possible to set the size of featured images on mobile version to "auto"?
website: http://marcinszkodzinski.pl (See the home page on your smartphone)
The best thing to do is set your image to as wide as it needs to be on mobile, then do any resizing using CSS on desktop. Images can be sized down, but not up.
Let me know if you need more info :)
I'm not sure I understand. :)
What would like to happen on mobile? It looks fine to me?
Horizontal position. :)
Basically, make your image larger than it currently is, so it looks good on mobile.
Then use CSS for desktop to make it smaller:
@media (min-width: 769px) {
.post-image img {
max-width: 250px;
}
}
Ok, thanks.
My page is almost ready.
The last question:
How to remove "page header" on mobile devices? The whole picture on the screen looks bad.
I want it to be just a picture before content
I hope you understand :)
It's a foreign language for me. :)
Since you are not adding contents in page header, try uploading it as featured images instead: https://docs.generatepress.com/article/adding-featured-images/
Let me know if this works for you.
On my page, the featured image it's the "page header". On mobile devices, this looks bad, so I would like this to be a normal image.
It means:
On computers, the featured image is in accordance with the settings of the page header.
On mobile devices, featured image is...a normal featured image.
Is it possible?
Would you like it to appear in the exact same spot as the current Page Header? So basically just a static image to replace the current Page Header background image?
Yes.
First, add this CSS:
@media (max-width: 768px) {
.page-header-content {
display: none;
}
}
Then, add this PHP:
add_action( 'generate_after_header', 'tu_add_static_featured_image' );
function tu_add_static_featured_image() {
if ( is_singular() ) {
echo '<div class="hide-on-desktop hide-on-tablet">';
the_post_thumbnail();
echo '</div>';
}
}