[Resolved] Link Post Format and Clickable Article

Home Forums Support [Resolved] Link Post Format and Clickable Article

Home Forums Support Link Post Format and Clickable Article

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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!

    #1292822
    David
    Staff
    Customer Support

    Hi there,

    can you link us to your site so we can take a look?

    #1292895
    Marek

    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!

    #1292914
    David
    Staff
    Customer Support

    Instead 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%;
    }
    #1293002
    Marek

    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 ๐Ÿ™‚

    #1293287
    David
    Staff
    Customer Support

    How are you adding the link URL to the post ?
    As that should happen by default

    #1294684
    Marek

    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!

    #1294897
    David
    Staff
    Customer Support

    Glad to hear that ๐Ÿ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.