-
AuthorPosts
-
September 26, 2018 at 9:06 am #1014591
Hi Team Kriesi,
is ist possible to show copyright-info for images inside a post and for the post thumbnail?
thanks in advance.September 26, 2018 at 9:13 am #1014596Hi,
Please add this code to your child theme:
function avia_display_image_copyright( $atts ) { $atts = shortcode_atts(array('id' => ''), $atts); $copyright_text = ''; if(!empty($atts['id'])) { $copyright_text = get_post_meta($atts['id'], '_avia_attachment_copyright', true ); } else { if(has_post_thumbnail()) { $post_thumbnail_id = get_post_thumbnail_id(); $copyright_text = get_post_meta($post_thumbnail_id, '_avia_attachment_copyright', true ); } } return $copyright_text; } add_shortcode( 'av_display_image_copyright', 'avia_display_image_copyright' );
You can then use this shortcode:
[av_display_image_copyright]
to display the copyright information of the featured image. If you want to display the copyright information of another image (which is not the featured image) you can use this code:
[av_display_image_copyright id=852]
and replace 852 with the (attachment) id of the image.
Best regards,
PeterSeptember 26, 2018 at 1:14 pm #1014709Shortcode doesnt make it to the frontend, but the copyright info is now part of the sourcecode.
I can set
small.avia-copyright from display:none to display
so I can show the copyright below the picture,
but shortcode is still visible and not active.
Do I have to put the shortcode into the loop?September 26, 2018 at 1:40 pm #1014720Hi,
Please create me an admin account and I’ll check why the shortcode is visible and doesn’t function properly.
If you want to use it inside the loop you need to call it like:
echo do_shortcode('[av_display_image_copyright]');
Best regards,
PeterSeptember 28, 2018 at 8:59 am #1015635WP Multisite – depending domain is the home-domain “Ramsau am Dachstein”. Login Credentials in private Sector.
September 30, 2018 at 9:56 am #1016228Hi,
Can you please activate the theme editor or install a plugin like: https://wordpress.org/plugins/theme-editor/ (otherwise I can’t view, modify or debug the shortcode code).
Best regards,
PeterOctober 3, 2018 at 1:02 pm #1017517Theme Editor is installed and active.
October 8, 2018 at 2:33 am #1018754Hi,
Where did you add the custom shortcode? It’s not in the functions.php file.
Best regards,
IsmaelOctober 8, 2018 at 8:57 am #1018855Thanks, now it works.
Not the style i want, but guess this is just css.
Great support.October 8, 2018 at 9:21 am #1018869Just curious, how can i achieve to get the copyright info with the hover-effect like in regular images?
October 10, 2018 at 4:13 am #1019724Hi,
It has to be inside a container with the “avia-copyright” class attribute.
<small class="avs avia-copyright">Something about copyright here or the custom shortcode above.</small>
CSS code.
.avs.avia-copyright { position: absolute; background-color: rgba(0,0,0,0.1); text-align: right; color: #fff; padding: 0 2em 0 0; right: 0; bottom: 0; width: 2em; line-height: 2em; max-height: 2em; text-indent: -99999px; overflow: hidden; transition: all 0.3s ease-in; z-index: 308; font-size: 0.8em; } .avs.avia-copyright:hover { width: 100%; padding: 0 3em 0 1em; text-indent: 0; max-height: 100%; background-color: rgba(0,0,0,0.4); } .avs.avia-copyright:after { content: "\E81e"; font-family: "entypo-fontello"; display: block; position: absolute; right: 0; bottom: 0; text-indent: 0; font-size: 0.8em; width: 2.6em; height: 2.6em; line-height: 2.8em; text-align: center; color: rgba(255,255,255,0.7); -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; cursor: pointer; }
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.