Home Forums Plugin Support WP User Frontend Pro Need to delete link on displayed image

This topic is: resolved

This topic contains 13 replies, has 2 voices, and was last updated by  webonsk 6 years, 1 month ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1776

    webonsk
    Participant
    Post count: 18

    Hello again 🙂

    I don't want to have a link to attachment on image, I need just image without link. Where can I delete this part of code?

    Thanks.

    #1783

    Tareq Hasan
    Keymaster
    Post count: 2831

    How are you displaying the image? Using shortcode?

    #1818

    webonsk
    Participant
    Post count: 18

    Yes, I'm using shortcode.

    #1828

    Tareq Hasan
    Keymaster
    Post count: 2831

    Deleting a part of plugin code is not a good solution as you will lose them in a next plugin update.

    If you can use code, here's the solution:
    [php]
    $images = get_post_meta( $post->ID, ‘mey_key_name' );
     
    if ($images) {
        foreach ($images as $attachment_id) {
            echo wp_get_attachment_image( $attachment_id, ‘thumbnail' );
        }
    }
    [/php]

    #1897

    webonsk
    Participant
    Post count: 18

    Thank you, Tareq, where should I put this code? Should I use it instead of shortcode? I don't know if I'm using it right, I keep getting error:

    Parse error: syntax error, unexpected ‘&' in..

    I also tried to put this code to my theme's functions.php, the result is the same: error.

    (I'm not a programmer, just designer with no PHP knowledge)

    #1900

    Tareq Hasan
    Keymaster
    Post count: 2831

    Seems like there was an unexpected character, fixed it.

    As the shortcode uses the image link, the only was you can show the image without link is with this code snippet. If you are showing the images in you post, then single.php of your theme is responsible for displaying your post and you should put the code snippet there.

    #1903

    webonsk
    Participant
    Post count: 18

    Ok, now it doesn't show any error, it just doesn't work – shows nothing.

    #1910

    Tareq Hasan
    Keymaster
    Post count: 2831

    What theme are you using? If you had the meta value in the meta key it should show up.

    #1913

    webonsk
    Participant
    Post count: 18

    I'm using Roots theme.

    #1914

    webonsk
    Participant
    Post count: 18
    This reply has been marked as private.
    #1915

    Tareq Hasan
    Keymaster
    Post count: 2831

    Did you gave the right meta key in the code snippet?

    #1916

    webonsk
    Participant
    Post count: 18

    Ok, so that was the problem! 🙂 Its okay now, thank you again!

    #1917

    Tareq Hasan
    Keymaster
    Post count: 2831

    So you didn't put the meta key, lolz.

    BTW, did you designed the site? It looks awesome.

    #1919

    webonsk
    Participant
    Post count: 18

    yes, no meta key, stupid-me 🙂

    And yes, I designed it, thank you!

    Kate

Viewing 14 posts - 1 through 14 (of 14 total)

The topic ‘Need to delete link on displayed image’ is closed to new replies.