Tagged: featured image caption
- This topic has 15 replies, 3 voices, and was last updated 4 years, 1 month ago by Theme Horse Support Team.
-
AuthorPosts
-
September 10, 2020 at 3:37 pm #80907September 11, 2020 at 3:43 pm #80937RobertoParticipant
i done it adding in /template-parts/content.php in row 36:
<?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>’;
}
?>September 13, 2020 at 2:33 pm #80994Theme Horse Support TeamKeymasterHi Roberto,
Did the code that you added worked? We think it doesn’t work.
Please remove those added code then on line no: 34. you will find the below code.
</figure><!-- .post-featured-image .page-single-img-wrap -->
Now replace the above mentioned code with the below provide code.
<figcaption class="featured-image-caption"><?php echo get_the_post_thumbnail_caption(get_the_ID()); ?></figcaption> </figure><!-- .post-featured-image .page-single-img-wrap -->
after replacing the code save the file and please go to ‘Appearance > Customize > Additional CSS’ and paste the below Custom CSS Code.
.post-featured-image.page-single-img-wrap { overflow: hidden; } .post-featured-image.page-single-img-wrap .featured-image-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 50px 25px 15px; color: #ffffff; background: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.5)); } @media (max-width: 767px) { .post-featured-image.page-single-img-wrap .featured-image-caption { padding-left: 15px; padding-right: 15px; } }
Thanks
September 13, 2020 at 6:00 pm #81003RobertoParticipantmy code works but your Is graphically better. but it no works so.
I modify so:<?php $get_description = get_post(get_post_thumbnail_id())->post_excerpt; if(!empty($get_description)){//If description is not empty show the div ?> <figcaption class="featured-image-caption"><?php echo esc_html ($get_description);?></figcaption> <?php } ?> </figure><!-- .post-featured-image .page-single-img-wrap --> <?php } ?>
.post-featured-image.page-single-img-wrap .featured-image-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 7px 25px 7px; font-weight:bold; font-style:italic; color: #ffffff; background-color: black; opacity: 70% } @media (max-width: 767px) { .post-featured-image.page-single-img-wrap .featured-image-caption { font-size:80%; text-align:center; padding-left: 15px; padding-right: 15px; } } }
September 14, 2020 at 11:07 am #81019Theme Horse Support TeamKeymasterOk the code we provided was just for the Featured Image caption so the only text set on Caption field will be displayed. The description won’t be displayed by that code.
Anyways its great that your code worked but you have added an extra ‘}’ (curly braces) at the end. If you are going to add some additional Custom CSS code after it then the code won’t work because of that extra curly braces.
Thanks
September 14, 2020 at 12:48 pm #81024RobertoParticipantA last question: how can i override inc folder in child theme?
September 15, 2020 at 4:07 pm #81044RobertoParticipantthe files in inc/ folder have not !function_exists
September 18, 2020 at 5:28 pm #81122RobertoParticipantPlease help me
September 20, 2020 at 1:55 pm #81151Theme Horse Support TeamKeymasterJust create the ‘inc’ folder on the Child Theme. and to link with the php files just use the code on main function.php file as mentioned below.
require get_stylesheet_directory() . '/inc/abc.php';
Thanks
September 20, 2020 at 4:53 pm #81157RobertoParticipantNo works
i put:
require get_stylesheet_directory() . '/inc/newscard-widgets.php';
i’ve error.
i want translate the words “populair”, “commented”, “recent” in /inc/newscard-widgets.php
September 25, 2020 at 3:41 pm #81314RobertoParticipantare you there?
September 26, 2020 at 5:19 pm #81380Theme Horse Support TeamKeymasterHi Roberto,
Just to translate those text it is not necessary to create child theme.
You can create a .po, .mo file to translate those text from the help of this plugin.Thank you!
September 26, 2020 at 5:25 pm #81383RobertoParticipantyour widget no use WordPress languege but it saved in PHP file in /inc/
October 27, 2020 at 11:54 am #82460Theme Horse Support TeamKeymasterSorry for late reply. We missed your reply.
What are you trying to say? Can you please clarify?Thank you!
October 27, 2020 at 3:26 pm #82465RobertoParticipanti fixed with plugin.
thank you very much. 🙂 -
AuthorPosts
- You must be logged in to reply to this topic.