Site logo

Archived topic

Can not make whole post clickable

1 reply · Started by Stef on July 15, 2021

Viewing posts 1–2 of 2

Hi,

@ejcabquina asked me to open a topic for this problem here.

I am using the WP Show Posts plugin together with Generatepress Premium. I followed all the directions and hooked a piece of code in the footer section of my website:


<?php
jQuery( document ).ready( function( $ ) {
    #( '#wpsp-555 article' ).on( 'click', function( e ) {
        var _this = $( this ),
            url = _this.find( 'a' ).attr( 'href' );

        if ( url ) {
            window.location.href = url;
        }
    } );
} );
?>

This somehow does not work. A sample site is wirodakwerken.nl. When I click on posttexts on the homepage nothing happens.

What am I doing wrong?

Regards,

Stef

Hi there,

thats code is Javascript - it should be in <script> tags:

<script>
jQuery( document ).ready( function( $ ) {
    #( '#wpsp-555 article' ).on( 'click', function( e ) {
        var _this = $( this ),
            url = _this.find( 'a' ).attr( 'href' );

        if ( url ) {
            window.location.href = url;
        }
    } );
} );
</script>
This archived topic is closed to new replies.