• hello,
    I hope someone can help me here.
    I need to change the featured image link via the functions.php when there is an featured image on the single.php.
    I upload the featured image via an frontend form, so no modification in the wordpress backend is possible.
    Right now the featured image links to the single post, thats fine but in the single.php it should link to the LARGE image.
    I allready changed it in my themes core, but this is a dirty solution 🙁

    `if( !is_singular() ) {

    echo ‘
    <a href=”‘ . get_permalink() . ‘” class=”post-thumbnail post-thumbnail-‘ . $position . ‘”>
    <img src=”‘ . esc_url($thumbnail_url) . ‘” alt=”‘ . the_title_attribute(‘echo=0’) . ‘” width=”‘ . $thumbnail_width . ‘” height=”‘ . $thumbnail_height . ‘” />
    </a>
    ‘;

    } else {

    echo ‘
    <a href=”‘ . $thumbnail[0] . ‘” class=”post-thumbnail post-thumbnail-‘ . $position . ‘”>
    <img src=”‘ . esc_url($thumbnail_url) . ‘” alt=”‘ . the_title_attribute(‘echo=0’) . ‘” width=”‘ . $thumbnail_width . ‘” height=”‘ . $thumbnail_height . ‘” />
    </a>
    ‘;

    }`

    can someone help me here, to put this in a function with a hook or something?

    thanks for help,
    Denis

Viewing 1 replies (of 1 total)
  • I allready changed it in my themes core, but this is a dirty solution 🙁

    why? if you are not aloready, have you considered to use a child theme?

    there is most likely no hook to change the link from within functions.php;

    what theme are you using?

    what is the full code of the single post template?

Viewing 1 replies (of 1 total)

The topic ‘Change Featured Image Link via functions.php’ is closed to new replies.