mejiwara
mejiwara

Reputation: 49

Code to show the thumbnail in wordpress custom code facebook sharer

<a title="Share this post/page"
href="http://www.facebook.com/sharer.php?
s=100

&p[url]=<?php the_permalink() ?>
&p[images][0]=
&p[title]=<?php the_title(); ?>
&p[summary]=<?php the_excerpt() ?>"
target="_blank">
<img src="http://www.ironwillfootball.ca/wp-content/themes/IronWillThemes/images/share_01.png"
alt="Share on Facebook" />
</a>

this my code for facebook share and this line -> &p[images][0]= is empty .. how can i add images here? what could be the code if the link to thumbnail in wordpress is like this -> img src= ID, $key, true); ?>

The real issue is i cant see the thumbnail when i share a post in wordpress..

Upvotes: 0

Views: 302

Answers (1)

cpilko
cpilko

Reputation: 11852

First off, sharer.php is deprecated and has been for some time. Keep in mind that it could stop working at any time. You are better off developing this using the Feed dialog.

Assuming your code is working inside the loop, you can use the WordPress get_posts() function to return the attachments. The WordPress Codex has an example that is exactly what you are looking for, so I won't repeat it here.

If you're doing this outside the loop, you need to use get_children() which is also described in the Codex

Upvotes: 1

Related Questions