• On my front page where it lists my posts, only the title is hyperlinked to get through to that post.

    How can I make it so that the featured image to the left is also clickable? Here is the code where I imagine the change will need to be made:

    <div class="wrap-post">
                    <?php $theme->hook('post_before'); ?>
    
                        <div <?php post_class('post clearfix'); ?> id="post-<?php the_ID(); ?>">
                        <?php $theme->hook('post'); ?>
    
                            <?php
                                if($theme->options['general']['featured_image'] && $theme->display('featured_image', $get_post_elements) && has_post_thumbnail())  {
                                    the_post_thumbnail(
                                        array($theme->get_option($theme->options['template_part'] . '_featured_image_width'), $theme->get_option($theme->options['template_part'] . '_featured_image_height')),
                                        array("class" => $theme->get_option($theme->options['template_part'] . '_featured_image_position') . " featured_image")
                                    );
                                }
                            ?>

    I assume I have to put this somewhere?

    <a href="<?php the_permalink(); ?>

    Thanks in advance,

Viewing 5 replies - 1 through 5 (of 5 total)
  • Yes you would use <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>

    Your code will look like this:

    <?php
    if($theme->options['general']['featured_image'] && $theme->display('featured_image', $get_post_elements ) && has_post_thumbnail() ) { ?>
        <a href="<?php the_permalink(); ?>">
        <?php the_post_thumbnail( array(
        $theme->get_option( $theme->options['template_part'] . '_featured_image_width'),
        $theme->get_option($theme->options['template_part'] . '_featured_image_height'),
        ),
     array(
     "class" => $theme->get_option( $theme->options['template_part'] . '_featured_image_position') . " featured_image",
     )
    ); ?></a>
    <?php } ?>

    Thread Starter muchacho79

    (@muchacho79)

    Hmmm, for some reason when I put that, the featured image disappears.

    I’m using the Hatch theme and looking for the same solution. Hatch doesn’t display vertical images and relies heavily on the “Featured Image” function. An image displays twice if it is inserted into the post and used as the featured image.

    @smilingdogstudio – please start your own thread as your question/situation is not identical to the one in this thread.

    Thank you WPyogi – I didn’t see in this thread where any theme was mentioned.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How can I make my featured images, clickable?’ is closed to new replies.