Tagged: , ,

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #1288547

    Dear Kriesi-Support-Team,
    I have a question about copyright information for images and can’t find anything about it in the forums …

    If I use your Advanced Editor, I can display the copyright information that was saved via the media library for every image. How do I display the copyright information when using the blog in the standard editor? Of course, I can also insert images using your shortcodes and then have the same functionality as in the Advanced Editor, but it would be better if I could insert the images in the classic way and still show the copyright information.

    Is there an option to do this? I found different snippets for the functions.php on the internet, but there is nothing that automatically worked with your wonderful theme.

    I am happy about your help. Many thanks in advance.

    #1288882

    Hi spooniverse,

    Can you give us a link to your site where the copyright image is shown? we’ll try to give further instructions once we can check the page.

    Best regards,
    Nikko

    #1288902

    Hey Nikko,
    basically i have the problem on several sites, all of which I run with your great theme.

    In the Advanced Editor I can set when and how the copyright should be displayed. In the blog I use the standard editor and insert the images via “insert media”. At this point I have no choice regarding the display of the copyright information.

    Enclosed you will find a link to an exemplary page. For the header image I found a short css code in the forums and the copyright shows beneath the picture. The picture is used again at the end of the article. Inserted via the standard editor. There we had to manually add the copyright in the caption, as there is no way to show it automatically …

    As I said, my aim is to show the copyright information for all images that are used in the blog via the standard editor, provided that the copyright information has been saved in the media library with the image.

    I found some snippets for functions.php on the web and the forums but none is working in the expected way.

    Hoping for a solution!

    Cheers, Daniel

    #1289206

    Hi Daniel,

    I see thanks for giving us the link, actually, I was thinking of the copyright text shown in the footer (I forgot that there was a copyright property to images).
    Unfortunately, there’s no option to do that to standard editor (which is from WordPress not Enfold), the only option is to show caption :(

    Best regards,
    Nikko

    #1289578

    Dear Nikko,

    Thank you for your answer. Since the data is saved in the database, it should also be able use it in the standard editor. There are even instructions on the Internet for this, but they refer to a selfmade copyright field (see link) but the field is already given by your theme.

    In the meantime I found a post from Ismael, unfortunately I don’t quite understand the explanation since it offers possibilities and not one single solution. It seems to be about exactly the issue that I am facing: https://kriesi.at/support/topic/copyright-images-2/#post-1228898

    Therefore I believe there is an option for this and would be happy to receive a brief explanation or instructions. Thank you!

    #1289906

    Hi spooniverse,

    Thanks for pointing it out, I tweaked it with this code (add this at the bottom of your child theme’s functions.php):

    add_filter('get_image_tag', function($html, $id, $alt, $title, $align, $size) {
    	$copyright_text = get_post_meta( $id, '_avia_attachment_copyright', true );
    	if ($copyright_text) {
    		$image = $html;
    		$html = '<figure class="my-image-wrapper">';
    		$html .= $image;
    		$html .= '<p class="my-copyright">' . $copyright_text . '</p>';
    		$html .= '</figure>';
    	}
    	return $html;
    }, 10, 6);

    This hook only triggers after you inserted an image (Add Media).
    You can style the wrapper with .my-image-wrapper and for the copyright text .my-copyright
    Hope this helps.

    Best regards,
    Nikko

    #1289982

    Hey Nikko,

    thanks for the code. I made some adjustments and it kind of works, but it’s not really convenient. I invested several hours to automatically place the copyright line with the image in the text, depending on the alignment of the image in the text flow.

    add_filter('get_image_tag', function($html, $id, $alt, $title, $align, $size) {
    	$copyright_text = get_post_meta( $id, '_avia_attachment_copyright', true );
    	if ($copyright_text) {
    		$image = $html;
    		$html = '<figure class="copyright-image-wrapper">' . $image;
    		$html .= '<p class="my-copyright">' . $copyright_text . '</p>';
    		$html .= '</figure>';
    	}
    	return $html;
    }, 10, 6);
    
    function copyright_textfluss(){
        ?>
        <script>
    		jQuery(document).ready(function($) {
    			$('.copyright-image-wrapper:has(.alignleft)').addClass('alignleft');
    			$('.copyright-image-wrapper:has(.aligncenter)').addClass('aligncenter');
    			$('.copyright-image-wrapper:has(.alignright)').addClass('alignright');
    		});
    	 </script>
        <?php
    }
    add_action('wp_head', 'copyright_textfluss'); 

    But there are still two problems:

    • All the html-markup stays in the blog entry if a picture is deleted. This is annoying and therefore not a really nice solution …
    • The copyright-information is simply copied into the text, there is no connection to the database. If there are changes to the copyright-information in the media library it won’t reflect in the blog.

    In the theme image-element it adds a snippet to the shortcode like [copyright=’icon-reveal’]. Couldn’t something like that also be implemented for the standard editor?

    Hope you have a good idea!

    #1290034

    Hi spooniverse,

    I understand, that’s why I mentioned it only triggers when adding the image.
    Standard Editor is not defined by Enfold but by WordPress, so this is actually out of the scope of our support.
    Since this is a general WordPress question and not based on the theme, try asking in https://stackoverflow.com/ some WordPress experts may be able to help or guide you on this topic.

    Best regards,
    Nikko

    #1290056

    Hi Nikko,

    I will try to find a good solution. But since the copyright is implemented through Enfold I would have to know which selector I have to use to call the copyright field content from an image with added copyright information.

    In your code I found:

    _avia_attachment_copyright

    Is this where the copyright information is saved?

    Could I use something like that:

    function get_image_copyright( $attachment_id = null ) {
    	$attachment_id = attachment_url_to_postid( $image_url );
    	if ( $attachment_id )
    		return get_post_meta( $attachment_id, '_avia_attachment_copyright', true );
    }

    Does that trigger the wanted information? If yes I only need a hint where to place a function to show it for every image in the blog.

    Something like:

    echo get_image_copyright();

    What do you think?

    All the best,
    Daniel

    #1290429

    Hi Daniel,

    _avia_attachment_copyright is correct however the problem would be how you would trigger that function for every image since there’s no actual hook for it.
    The only way I can see this work is through modifying a WordPress core file wp-includes > media.php which is not recommended

    Best regards,
    Nikko

    #1290445

    Hi Nikko,
    Thanks for your reply. I found some links online that seemed to offer a solution for this problem. Isn’t the link in private about basically the same thing I want to achieve?
    Best regards,
    Daniel

    #1290453

    is it possible to discuss publicly things that might interest other participants?
    Maybe your link could be informative for others too!

    #1290779

    For sure, Guenni, nor problem: https://bavotasan.com/2012/add-a-copyright-field-to-the-media-uploader-in-wordpress/. What do you think? Any suggestions?

    #1290830

    well if you look to enfold functions-enfold.php you will find this on lines 2336ff
    that allready exists – with little adjustments to enfold nomenklatura – and was the way enfold includes that extra field to media library.

    #1294046

    That is true, Guenni. Thanks for your advice. I want to use the information from the copyright field in the standard WordPress text editor also, not only in avia layout architect. Therefore I need to load the copyright information from the field inserted by Enfold into a standard editor blog post. Basically that is working with Nikkos code (thanks!) but it is not dynamic (see post #1289982 above). Any ideas?

    All the best, Daniel

    #1324695

    Does anyone know whether it is possible to collect a list of all picture credits specified in the media library on one page via a shortcode or something similar? Maybe this could be an other way to solve my problem …

    #1332931

    No idea how to solve this? I think the information is in the database and could be loaded somehow.

    If a user could place a shortcode like

    [media_copyright]

    on a page and this would display a list in the frontend like

    Media name (linked to page where it is used): Copyright information
    Media name (linked to page where it is used): Copyright information
    Media name (linked to page where it is used): Copyright information

    and if an image is used multiple times it has multiple entries in the list.

    Something like this would be quite helpful for users in Europe …

    Does anyone know whether it is possible to collect a list of all credits specified in the media library on one page via a shortcode or something similar?

    #1332957

    Hi,
    Sorry, this could not easily be done within our forum support scope, perhaps there is already a WordPress Plugin that can do this, otherwise you could consider hiring a customization freelancer.

    Best regards,
    Mike

Viewing 18 posts - 1 through 18 (of 18 total)
  • The topic ‘Show Copyright for images in Standard Editor Blog Posts’ is closed to new replies.