- This topic has 16 replies, 4 voices, and was last updated 3 years, 2 months ago by Ying.
-
AuthorPosts
-
January 29, 2021 at 6:40 am #1638126Raul
Hi,
I want to add the caption of my main-image from a post directly as overlay over the image in right or left corner. Is that possible?My idea is something like an hook-element:
<div class="featured-image-capture"><?php $get_description = get_post(get_post_thumbnail_id())->post_excerpt; if(!empty($get_description)){//If description is not empty show the div echo '<div class="featured_caption">' . $get_description . '</div>'; } ?></div>
My problem is that with a hook it will be not possible to get it as overlay over the picture.
And generate_before_entry_title. Than I have to add some CSS code do slide it over the picture. Is that the right way? With “position: absolute;”? it’s working only if the size of screen will not change.
January 29, 2021 at 7:10 am #1638392DavidStaffCustomer SupportHi there,
see this topic, aside of the vertical alignment of the caption, this method works:
https://generatepress.com/forums/topic/vertical-caption-align-with-picture/#post-1377630
January 29, 2021 at 8:31 am #1638491RaulThat works, thanks, But cannot set background for the caputre with
.thumb-caption-text p {}January 29, 2021 at 8:36 am #1638497DavidStaffCustomer SupportCan you share a link to where i can see the issue?
January 29, 2021 at 8:41 am #1638508RaulSure: https://pcpointer.de/news/microsoft-flight-simulator-2020-welt-update-3/
I wanted something like a back background to get it more readable …
January 29, 2021 at 8:44 am #1638512DavidStaffCustomer SupportI can’t see the caption on that image ?
January 29, 2021 at 8:48 am #1638518RaulIt is on the right side, I can see it on pc and smartphone 😉
January 29, 2021 at 8:52 am #1638528January 29, 2021 at 8:56 am #1638535RaulI used the code from your linked post and it works on all computers here …
January 29, 2021 at 10:01 am #1638617RaulI tried this here and it works but it does not look clean:
.wp-caption-text.thumb-caption-text{ padding: 20px; margin: -20px -60px 10px 0px; background-color: rgba(0, 0, 0, 0.35)!important; background: -webkit-gradient(linear, left bottom, left top, color-stop(30%, rgba(80, 50, 50, 0.5)), to(rgba(0, 0, 0, 0.5)))!important; background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 30%, rgba(0, 0, 0, 0.5) 100%)!important; font-size: 16px; }
January 29, 2021 at 10:39 am #1638661LeoStaffCustomer SupportI’m seeing the same thing as David:
https://www.screencast.com/t/WZYNdG2grCan you clear and disable WP Rocket?
January 29, 2021 at 10:46 am #1638672RaulI disabled WP Cache … I tested it on a new computer and still works fine with different browser …
January 29, 2021 at 4:16 pm #1638873LeoStaffCustomer SupportI can see it now.
Are you trying to change the background color of the caption?
If so modifying
background
andbackground-color
of these CSS:.thumb-caption-text { writing-mode: vertical-rl; transform: rotate(180deg); margin-bottom: 0; color: #fff; background-color: red!important; }
and
* .inside-article p.thumb-caption-text { padding: 20px!important; background-color: rgba(0, 0, 0, 0.35)!important; background: -webkit-gradient(linear, left bottom, left top, color-stop(30%, rgba(80, 50, 50, 0.5)), to(rgba(0, 0, 0, 0.5)))!important; background: linear-gradient( 0deg , rgba(0, 0, 0, 0.5) 30%, rgba(0, 0, 0, 0.5) 100%)!important; font-size: 16px; }
January 30, 2021 at 12:07 am #1639052RaulYes but with padding i have the problem that this caption is on different positions and not exactly on the border of the image if I change the website size or use a mobile phone.
January 30, 2021 at 5:55 am #1639302DavidStaffCustomer SupportThe problem you will have on any small device is that a longer caption will be bigger then the image being displayed.
Where exactly do you want it displayed on desktop ? And how do you want it to behave when viewed on a mobile phone ?
-
AuthorPosts
- You must be logged in to reply to this topic.