• Hi!

    I was trying to link my thumbail image for every post to the permalink of the post. I found this code and a lot of people seems like having success by adding it to the functions.php:

    add_filter('excerpt_more', 'supernova_new_excerpt_more');
    function supernova_new_excerpt_more($more) {
           global $post;
    	return '<a class="moretag" href="'. get_permalink($post->ID) . '">'.__('... Read More', 'Supernova').'</a>';}
    add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
    
    function my_post_image_html( $html, $post_id, $post_image_id ) {
    
      $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . $html . '</a>';
      return $html;
    
    }

    Doesnt’t work for me 😀
    Please help

Viewing 8 replies - 1 through 8 (of 8 total)
  • the filter code generally seems to work in my local test site.

    what theme are you using?

    what is the result of that code in your site?

    can you post a live link to illustrate that result?

    Thread Starter supportmauro

    (@supportmauro)

    Hi!

    I’m using the Supernova Theme.

    I actually have no result from that code… just nothing happens.

    This is my site: http://www.vacanze-go.it

    have you contacted the developer of your theme for support?

    what ‘featured image’ are you referring to?
    can you post a direct link to a post or page with a featured image?

    http://codex.wordpress.org/Post_Thumbnails

    The theme already has permalinks to all post listing thumbnails (look at the demo site. http://supernovathemes.com/supernova/)
    If the filter isn’t working which Im sure should , you can wrap your custom thumbnail in <a href="<?php the_permalink(); ?>"></a> in loop.php file.

    Thread Starter supportmauro

    (@supportmauro)

    Hi guys and thanks for your help!

    Unfortunately i still can’t get it goingt

    @alchymyth
    I’m referring to all featured images. Have a look at my homepage.

    @sayed Taqui
    This is really weird! I see it’s working on the themes’ page but it’s not working on mine. Sorry, but i really don’t know where to put that code you posted 😀 This is what I find in my loop.php:

    <?php
    /**
     * The loop that displays posts for all post listings and can also be used in child themes.
     * @package Supernova
     * @since Supernova 1.4.0
     */
    
    if (have_posts()) : while (have_posts()) : the_post(); ?>
        <article <?php post_class() ?> id="post-<?php the_ID(); ?>">
            <h2 class="post_title" ><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
            <div class="entry">
                <a href="<?php the_permalink(); ?>"><?php supernova_thumbnail(get_the_ID()); ?></a>
                    <?php supernova_content(); ?>
                <div class="clearfix"></div>
            </div><!--entry -->
            <?php do_action('supernova_meta'); ?>
        </article>
        <?php endwhile; else :
            if(!is_search()){
           echo "<h2>".__('Siamo spiacenti, non ci sono risultati per la tua ricerca', 'Supernova')."</h2>";
            }else{
                echo "<h3>".__('Siamo spiacenti, ma non ci sono risultati per la tua ricerca', 'Supernova')."</h3>";
            }
    endif; ?>
    
    <div class="clearfix"></div>

    Then you are certainly using some plugin for the post thumbnail. Please deactivate it , and it should be fine.

    Thread Starter supportmauro

    (@supportmauro)

    Well, I really wish it was that easy… but I’m not using any plugin for thumbnails.

    If you wish you can leave the login information here http://supernovathemes.com/contact-me/ and I’ll be happy to have a look

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Link Thumbnail to permalink not working’ is closed to new replies.