Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1110541

    Hi Support-team,

    We try to find a solution to change the link of a Post Image on Post-Archive from a link to Autor-Page to the blogpost. Same link like the link on the title. Is there a hook to get that?

    Thanks for Four your help
    Tobias

    #1110671

    Hey Tobias,
    Please try the author_link filter in your functions.php:

    // redirect author link
    add_filter( 'author_link', 'modify_author_link', 10, 1 );      
    function modify_author_link( $link ) {     
        $link = 'http://example.com/';
    return $link;          
    }
    

    Please adjust the url to suit.

    Best regards,
    Mike

    #1110681

    Hi Mike,

    thanks thats a nice hook. But we looking for a solution to change only the Link from the featured image. the link should go to blogpost and not to author page.

    Is there another hook to change that?

    Thanks for your answer

    Tobias

    #1110716

    Hi,
    Will all of the featured images going to link to the same site or page or does each need to be a different link?

    Best regards,
    Mike

    #1110733

    Hi Mike,

    each to a different post. The same link like the link of the post title.

    Thanks for your help.

    Tobias‘

    #1110810

    Hi,
    I didn’t find a filter for it but I did write this javascript to replace the image url with the title url.
    Try adding this code to the end of your functions.php file in Appearance > Editor:

    function archive_img_link(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
      $(".entry-content-wrapper").each(function(){
        var posturl = $(this).find("h2.post-title.entry-title a").attr("href");
        $(this).find(".big-preview.multi-big a").attr("href", posturl);
    
    });
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'archive_img_link');

    Please give this a try and also check other pages and posts for conflicts.

    Best regards,
    Mike

    #1111556

    THANK YOU VERY MUCH MIKE!

    That works great!

    Tobias

    #1111802

    Hi,
    Glad to help, we will close this then, but please open a new thread if there is anything we can help with.
    Have a great day and thanks for using Enfold.

    Best regards,
    Mike

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Change Link to blog Post Not Autor-Page’ is closed to new replies.