Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1014591

    Hi Team Kriesi,
    is ist possible to show copyright-info for images inside a post and for the post thumbnail?
    thanks in advance.

    #1014596

    Hi,

    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,
    Peter

    #1014709

    Shortcode 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?

    #1014720

    Hi,

    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,
    Peter

    #1015635

    WP Multisite – depending domain is the home-domain “Ramsau am Dachstein”. Login Credentials in private Sector.

    #1016228

    Hi,

    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,
    Peter

    #1017517

    Theme Editor is installed and active.

    #1018754

    Hi,

    Where did you add the custom shortcode? It’s not in the functions.php file.

    Best regards,
    Ismael

    #1018855

    Thanks, now it works.
    Not the style i want, but guess this is just css.
    Great support.

    #1018869

    Just curious, how can i achieve to get the copyright info with the hover-effect like in regular images?

    #1019724

    Hi,

    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

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.