• mikhak

    (@mikhak)


    Hi.

    I want linking image to post and for doing this i installed Linked Image plugin . that’s very good plugin but linking only pictures have linking to file address and other pictures that no any link or i removing that’s link . don’t work . please help me and introduce a plugin or function that can linking any image .

    thanks.

    [ No bumping please. ]

Viewing 1 replies (of 1 total)
  • Thread Starter mikhak

    (@mikhak)

    with this code i able to linking images . but only that images linking that have have linking to file URL . please helping for create a new code that able linking all images .

    function wpguy_linked_image($content){
    $searchfor = '/(<img[^>]*\/>)/';
    $replacewith = '<a target="_blank" href="'.get_permalink().'">$1</a>';
    {
      $content = preg_replace($searchfor, $replacewith, $content);
    }
    return $content;
    }
    add_filter('the_content', 'wpguy_linked_image');
Viewing 1 replies (of 1 total)
  • The topic ‘A plugin or function for linking to image’ is closed to new replies.