Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1287894

    I’m using the Post Slider to display upcoming events, and the posts for the events are set to the link post type, with links pointing to the event page of the conference provider. How can I set the entries in the post slider to go directly to the link the post refers to no matter where on the entry a visitor clicks? They also need to be opened in a new window, but I think I can figure that part out.

    I’m testing the settings on this page: https://sentryti.com/testing-the-slider/

    If someone happens to click on the “Sign up” link in the excerpt, that does what I want, but I need for clicking on anywhere in the slide to do the same thing.

    • This topic was modified 3 years, 4 months ago by Lissasan. Reason: misspelled event, corrected
    #1289163

    Hey Lissasan,
    Sorry for the very late reply and thanks for your patience. To change the post slider img link to the same link in the post slider excerpt, try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_script() { ?>
        <script>
    (function($){
      $(document).ready(function(){
      $("article.slide-entry").each(function(){
        var callinkurl = $(this).find(".slide-entry-excerpt.entry-content a.callink").attr("href");
        $(this).find("a.slide-image").attr("href", callinkurl);
    
    });
    });
    })(jQuery);
    </script>
        <?php
    }
    add_action('wp_footer', 'custom_script');

    I tested this on your test page by injecting the javascript via the browser and it worked correctly, but a key point is that your post slider excerpt link has the custom class “callin”, so please ensure you continue to add this custom class.
    Please give this a try and let me know if this helps.

    Best regards,
    Mike

    #1289293

    Mike, thank you so much, this has produced exactly the result we needed.

    This can be considered closed with a very happy customer.

    #1289296

    Hi,

    I’m glad this was resolved. If you need additional help please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Post Slider with Link Post Types’ is closed to new replies.