By default there is a space between the title and image, can you send me the url of the post where you have this problem?
Thread Starter
Milan
(@mimoho)
Yes, there is some little space. But when I add a larger space to increase the gap on top of the post title to the feature image assuming that the image is set for the top position in a post, it is affecting also posts without feature image as I need to choose global custom CSS:
}
.entry-header {
padding-top: 30px;
}
I’d like the margin to be there only when there is a feature image displayed in the post. It would help to get assistance for determining this in CSS, but a solution in OceanWP Settings -> Title for margin and a tick box for “enable only when feature image is present” would be preferable.
Hi, I cannot add too many settings to not bloat the theme so I can only add necessary settings.
You will need to add a class in the body if there is or not a featured image, then you will be able to do something like this:
.custom-body-class .entry-header {
padding-top: 30px;
}
To add the class, add this code in the functions.php file of your child theme:
function prefix_body_classes( $classes ) {
if ( has_post_thumbnail() ) {
$classes[] = 'custom-body-class';
}
// Return classes
return $classes;
}
add_filter( 'body_class', 'prefix_body_classes' );