Archived topic
Copyright Picture
11 replies · Started by midiman on April 5, 2020
Hello, how can I insert a copyright text under the picture?
Hi there,
Under what picture?
Can you link me to the page in question?
Thanks :)
Hello, under main picture. How can I upload a photo to you?
Hi there,
for screenshots - please provide the full URL to a share drive where the image is located.
My Homepage is: https://ratgeberpro.de/private-krankenversicherung/
If you add the snippet i provide here to your site:
https://gist.github.com/diggeddy/5f7c3a4584a8beb51febc9c4f33d6c5c
Adding PHP: https://docs.generatepress.com/article/adding-php/
This will add the image Caption below the Featured image.
where should I put that?
add_filter( 'post_thumbnail_html', 'custom_add_post_thumbnail_caption',10,5 );
function custom_add_post_thumbnail_caption($html, $post_id, $post_thumbnail_id, $size, $attr) {
if( $html == '' ) {
return $html;
} else {
$out = '';
$thumbnail_image = get_posts(array('p' => $post_thumbnail_id, 'post_type' => 'attachment'));
if ($thumbnail_image && isset($thumbnail_image[0])) {
$image = wp_get_attachment_image_src($post_thumbnail_id, $size);
if($thumbnail_image[0]->post_excerpt)
$out .= '
$out .= $html;
if($thumbnail_image[0]->post_excerpt)
$out .= '<p class="wp-caption-text thumb-caption-text">'.$thumbnail_image[0]->post_excerpt.'</p>
';
}
return $out;
}
}
this document explains:
https://docs.generatepress.com/article/adding-php/
TLDR:
If you have Child Theme installed - add it to the functions.php
If NOT then use the Code Snippets plugin: https://en-gb.wordpress.org/plugins/code-snippets/
I use Elements, is that also possible?
Not using that Code.
But you can add this to a Hook Element:
<?php
$get_description = get_post(get_post_thumbnail_id())->post_excerpt;
if(!empty($get_description)){
echo '<span class="featured_caption">' . $get_description . '</span>';
}
?>
Select the before_content hook, check execute PHP and set the Priority to 15.
NOTE: This will place it below the container the featured image sits in.
Thanks
You're welcome