This topic contains 13 reply and 2 voices, and was last updated by webonsk 6 years, 6 months ago
Viewing 13 Posts - 1 through 13 (of 13 total)
Author Posts
April 4, 2013 at 1:49 pm 1776
webonsk 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.
April 4, 2013 at 5:16 pm 1783
Tareq Hasan Tareq Hasan

How are you displaying the image? Using shortcode?

April 5, 2013 at 7:50 am 1818
webonsk webonsk

Yes, I’m using shortcode.

April 5, 2013 at 2:41 pm 1828
Tareq Hasan Tareq Hasan

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]

April 8, 2013 at 8:18 am 1897
webonsk webonsk

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)

April 8, 2013 at 9:15 am 1900
Tareq Hasan Tareq Hasan

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.

April 8, 2013 at 10:25 am 1903
webonsk webonsk

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

April 8, 2013 at 12:53 pm 1910
Tareq Hasan Tareq Hasan

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

April 8, 2013 at 3:11 pm 1913
webonsk webonsk

I’m using Roots theme.

April 8, 2013 at 3:15 pm 1914
webonsk webonsk This reply has been marked as private.
April 8, 2013 at 3:18 pm 1915
Tareq Hasan Tareq Hasan

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

April 8, 2013 at 3:20 pm 1916
webonsk webonsk

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

April 8, 2013 at 3:25 pm 1917
Tareq Hasan Tareq Hasan

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

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

April 8, 2013 at 3:31 pm 1919
webonsk webonsk

yes, no meta key, stupid-me 🙂

And yes, I designed it, thank you!

Kate

Viewing 13 Posts - 1 through 13 (of 13 total)