- This topic has 7 replies, 2 voices, and was last updated 5 years, 10 months ago by
David.
-
AuthorPosts
-
May 19, 2020 at 11:49 am #1292539
Marek
Hey guys, congrats on 6 years!
I’m using this bit of code to make the entire .inside-article blog post containers clickable:
<script>
jQuery( document ).ready( function($) {
var body = $( ‘body’ );
if ( body.hasClass( ‘blog’ ) || body.hasClass( ‘archive’ ) ) {
$( ‘.type-post’ ).on( ‘click’, function() {
var link = $( this ).find( ‘.entry-title a’ ).attr( ‘href’ );
if ( link ) {
window.location = link;
}
} );
}
} );
</script>This works great; however, when utilizing the Link Post Format, the container links to the actual link post and not the page that the link post links to.
Any ideas on how to get the clickable container to link to the linked post in the link post type rather than the post itself?
It works fine if I click on the title of the link post type as it normally does.
I hope that wasn’t too confusing!
Thanks!
May 19, 2020 at 3:50 pm #1292822David
StaffCustomer SupportHi there,
can you link us to your site so we can take a look?
May 19, 2020 at 4:46 pm #1292895Marek
Hey David,
The site is incomplete but I just uploaded it to a temporary server and linked it in the post.
If you look at the homepage you will see a post titled “Link Test Page.” It is a Link Post format so when clicked it should take the user to the first link on that post.
The entire container is clickable but different spots link to different pages. Clicking the image takes the user to one page, and clicking the title or empty space will take the user elsewhere.
My goal is to have users click anywhere on the container and land on the page that is linked, and not the actual Link format post itself.
The clickable containers work great elsewhere, but it gets a little wonky with the link post format.
Thanks!
May 19, 2020 at 5:18 pm #1292914David
StaffCustomer SupportInstead of the jQuery – try this CSS method:
.generate-columns .inside-article { position: relative; } .generate-columns .inside-article .entry-header a:before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; }May 19, 2020 at 7:16 pm #1293002Marek
Thanks for the quick reply!
That works well and all the links are consistent now, but the link post still doesn’t take me to the desired page.
It takes me to the actual link post instead of the post that it should be redirected to (About Page).
Thanks 🙂
May 20, 2020 at 1:22 am #1293287David
StaffCustomer SupportHow are you adding the link URL to the post ?
As that should happen by defaultMay 20, 2020 at 8:22 pm #1294684Marek
Hey David,
I’m a goof, it was still linking to the localhost URL when I sent it over to you. That did work.
Thanks!
May 21, 2020 at 12:39 am #1294897David
StaffCustomer SupportGlad to hear that 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.