Linking featured image to Large image

Community Forums Forums Design Tips and Tricks Linking featured image to Large image

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Morten 1 year, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18004

    Morten
    Participant
    Post count: 2

    I’m using the Generate theme, and I trying to make the featured image link to a large version of the image instead of the post itself, but only on single posts.
    I can make part of this happen (probably not the right way though) by changing “Get_permalink()” to “$image_lightbox” and adding the following to function.php
    if ( $image_lightbox = genesis_get_image( array( ‘format’ => ‘url’, ‘size’ => ( ‘large’ ) ) ) )
    The problem is that this also changes the link on the blog/archive pages. I tried messing around with “if ( is_single” )” but can’t get it to work
    Can anyone help me or point me in the right direction
    Thanks
    Morten

    #18082

    SoZo
    Moderator
    Post count: 1573

    What is the full function you’re using? How did you add in the conditional tag?


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    #18199

    Morten
    Participant
    Post count: 2

    I just changed the existing code a little, added the bolded line and changed the get_permalink()

     

    /** Add custom post image above post title */
    add_action( ‘genesis_before_post_content’, ‘generate_post_image’, 5 );
    function generate_post_image() {

    if ( is_page() || ! genesis_get_option( ‘content_archive_thumbnail’ ) )
    return;
    if ( $image_lightbox = genesis_get_image( array( ‘format’ => ‘url’, ‘size’ => ( ‘large’ ) ) ) )

    if ( $image = genesis_get_image( array( ‘format’ => ‘url’, ‘size’ => genesis_get_option( ‘image_size’ ) ) ) ) {
    printf( ‘<a href=”%s” rel=”bookmark”><img class=”post-image” src=”%s” alt=”%s” /></a>’, $image_lightbox, $image, the_title_attribute( ‘echo=0′ ) );
    }

    }

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

You must be logged in to reply to this topic.