I was trying to make clickable articles in wordpress (stackoverflow.com), but with a few tests, I realised that the code I was typing is just not working at all.
It is indeed applied to the php files, but not working.
Two examples :
- Adding html to content-single.php does not work
- Adding the function below in function.php does not work
_
function clickable_article( $content ) {
if ( is_single() ) {
?>
<script>
jQuery( document ).ready( function( $ ) {
// add a cursor
$( '.entry-content' ).css("cursor", "pointer");
// on content click go to article url
$( '.entry-content' ).on( 'click', function( e ) {
var url = window.location.href;
window.location = url;
} );
} );
</script>
<?php
}
return $content;
}
add_filter( 'the_content', 'clickable_article' );
I desactivated some "anti-spam" plugins bot nothing seems to be working anyway.
Thank you in advance for your help !
CodePudding user response:
Are you able to make changes in other files of your current theme? If you have enabled any cache plugin clear the cache first then check the changes you have made.