@creedon Your 7.1 code works like a charm for my client's website. However, whenever I click on the image, the link opens in a new tab, which I don't want. All URLs need to open in the same tab, because I use the Source URL option to redirect to an internal page.
Below the code I have injected in the Page Header Code Injection of the blogsection - what part of the code should I modify to force the URL to open in the same screen?
Also, here the URL to the page: https://www.statisfact.nl/ons-werk/projecten
<script>
$( ( ) => {
/*
change blog listing item image URL to Source URL
Version : 0.1d1
SS Version : 7.1
Dependancies : jQuery
twcsl
By : Thomas Creedon < http://www.tomsWeb.consulting/ >
*/
let targetAtttributeValue = ''; /* use _self | _blank | _parent | _top |
framename see
< https://mzl.la/2Q0JROF > */
// do not change anything below, there be the borg here
if ( ! twcsl.blogPage.isList ) return; // bail if not blog listing
$( '.blog-title .passthrough-link' )
.filter ( function ( ) {
return $( this ).attr ( 'target' ) !== undefined;
} )
.each ( function ( ) {
const $this = $( this );
const url = $this.attr ( 'href' );
let $imageLink = $this
.parents ( '.blog-item' )
.find ( '.image-wrapper' )
.attr ( 'href', url );
if ( ! targetAtttributeValue ) {
const v = $this.attr ( 'target' );
if ( v !== undefined ) targetAtttributeValue = v;
}
if ( targetAtttributeValue )
$imageLink.attr ( 'target', targetAtttributeValue );
} );
} );
</script>