Tagged: x
-
AuthorPosts
-
March 5, 2017 at 10:56 am #1395177
davidferpParticipantHi X-ers!,
The posts of my blog are designed to include a featured image at the top before the post title, and the site menu overlays the featured image in single post view (see ‘with features image.png’ attached).
However, when no featured image is defined, the site menu appears directly above the post title, which is not the intended effect I am searching for (see ‘without features image.png’ attached).
In posts without featured image defined I want to apply enough top padding to avoid the post title to appear underneath the site menu. I guess the solution combines PHP and CSS but I cannot seem to solve the problem.
Any thoughts?
Thanks a lot guys for your very much appreciated help
Regards,
March 5, 2017 at 11:13 am #1395194
ThaiModeratorHi There,
Please provide us with your website URL so we can take a closer look.
Thanks.
March 5, 2017 at 12:55 pm #1395270
davidferpParticipantSure thing, here you go: http://www.2cameras1bucketlist.com
March 5, 2017 at 11:13 pm #1395693
Paul RModeratorHi,
To fix it, add the code below in your child theme’s functions.php
add_action('body_class', 'ed_if_featured_image_class' ); function ed_if_featured_image_class($classes) { if ( has_post_thumbnail() && is_singular('post')) { array_push($classes, 'has-featured-image'); } return $classes; }Then change the code in your custom css that reads.
@media (min-width: 980px) { .single-post .x-main.full { margin-top: -171px; } }with this
@media (min-width: 980px) { .single-post.has-featured-image .x-main.full { margin-top: -171px; } }Hope that helps.
March 6, 2017 at 8:12 am #1396254
davidferpParticipantHello there,
I certainly helps! Thanks a lot!
March 6, 2017 at 9:07 am #1396317
JoaoModeratorGlad to hear it,
Cheers
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1395177 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
