Click on image in featured slider to go to post

  • jamilla

    #1602

    Hi Guys,

    I’ve made a few changes to the featured slider on my site to only display the images rather than the title and excerpt.

    Can you advise how I can make the image in the slider clickable rather than keeping the ‘Continue reading’?

    Please also note, I haven’t yet upgraded from 1.3.1, as I need to do some testing as the website has a few plugins 🙂

    Cheers

    Jami

    Admin

    Syahir Hakim

    #16469

    I just did something like this for one of my clients the other day.

    Two things you need to do. First, add this code to your child theme’s functions.php file:

    <?php
    /**
    * Make slider posts clickable
    */
    function graphene_clickable_slider(){
    ?>
    <a href="<?php global $post; echo get_permalink( $post->ID ); ?>" class="slider-link"></a>
    <?php
    }
    add_action( 'graphene_before_sliderpost', 'graphene_clickable_slider' );
    ?>

    Then, add this into your child theme’s style.css file or the Custom CSS option:

    .slider-link {
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 10;
    display: block;
    }

    `

    jamilla

    #16470

    Ahh you’re awesome.. Thanks Syahir!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Do NOT follow this link or you will be banned from the site!