|
#1
Dec 2, 2009, 12:08 AM
|
|
I found this guide intriguing, but it's intended for Thesis:
http://www.wolf-howl.com/blogs/thesis-digg-facebook/
Is there a way to do this with Atahualpa? It's basically a way to tell Facebook and Digg what image to use when you post a link from your site to them.
I am guessing you would have use a custom field with the URL of the image you want, but I am not exactly sure how to do this using Atahualpa "language" and every time I've tried to edit the functions of Atahualpa it crashes.
Last edited by adum; Dec 7, 2009 at 11:01 AM.
|
#2
Dec 7, 2009, 12:08 PM
|
|
|
|
3,768 posts · Oct 2008
Munich, Germany
|
|
Yes, add the code to functions.php
PHP Code:
function get_social_img() { global $post; if ( is_single ()){ $image = get_post_meta($post->ID, 'title_of_your_custom_field', $single = true); ?> <link rel="image_src" href="<?php echo $image; ?>" /> <? } } add_action('wp_head', 'get_social_img');
You could also automate this without custom fields
PHP Code:
function get_social_img() { global $post; if ( is_single ()){ $image = "http://www.yoursite.com/socialimages/".$post->ID.".jpg"; ?> <link rel="image_src" href="<?php echo $image; ?>" /> <? } } add_action('wp_head', 'get_social_img');
This would print
HTML Code:
<link rel="image_src" href="http://www.yoursite.com/socialimages/17.jpg" />
on the single post page of the post with the ID #17
You'd put the images into yoursite.com/socialimages/
|
#3
Dec 8, 2009, 02:03 PM
|
|
Thanks so much Flynn, it works perfectly.
Do you know if there it a way to automatically detect the first image within a post, or would that be really complicated? Just curious, don't feel obligated to come up with anything because it's working awesome right now. I'm so happy.
|
#4
Apr 14, 2010, 09:52 AM
|
|
Hi
May i know , does the code above work for other wordpress themes.
Thank you.
Best regards
Anthony
|
#5
Apr 14, 2010, 01:43 PM
|
|
I'd like to control the thumbnail for just the homepage link in Facebook.
Also, where in functions.php does the code snippet above get inserted?
|
#6
Apr 15, 2010, 01:44 PM
|
|
Hi
I already try the mentioned code in my php.admin.
I do change the code as below, please let me know am i correct to change this. now there is no image for facebook thumbnail at all.
Code:
function get_social_img() {
global $post;
if ( is_single ()){
$image = "http://mysite.com/wp-content/uploads/".$post->ID.".jpg";
?>
<link rel="image_src" href="<?php echo $image; ?>" />
<?
}
}
add_action('wp_head', 'get_social_img');
thank you.
Last edited by anthonyportal; Apr 15, 2010 at 01:46 PM.
|
#7
Apr 15, 2010, 01:55 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
lets say you were on post 22, that code will be looking for a image called "http://mysite.com/wp-content/uploads/22.jpg"
do you have that image?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#8
Apr 15, 2010, 10:38 PM
|
|
HI juggledad,
Although i have upload it to my uploads folder, but it still show no thumbnail.
May i check with you the code that i change in bold blue , it that correct.?
thank you
|
#9
Apr 16, 2010, 07:25 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
I think that is the correct place to change - you did put in your domain name right?
what version of atahualpa and WP?
What is your url?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#10
Apr 17, 2010, 12:11 AM
|
|
HI juggledad,
First thank you for this information, i not sure what i do now is working fine.
Thank again ... juggledad
I have a another meta tag issue.
Which is meta tag for Flash video
Do you mind to share what is the coding for Flash embedded.
I found some extra information on Flash embedded code. but i not too sure how to coding it for my wordpress blog.
http://wiki.developers.facebook.com/...ying_Meta_Tags
Thank you.
|
#11
Apr 25, 2010, 06:49 PM
|
|
The above code I had posted was wrong...it was missing something.
This is what I use now that works:
// facebook connect digg social media image
function get_social_img() {
global $post;
if ( is_single ()){
$image = "";
$image = get_post_meta($post->ID, 'Thumbnail', $single = true);
?>
<link rel="image_src" href="<?php echo $image; ?>" />
<?
}
else {
?>
<link rel="image_src" href="http://www.sixprizes.com/images/6P.gif" />
<?
}
}
|
#12
Jun 21, 2010, 01:14 PM
|
|
I am having a similar issue with Facebook showing my Header images as thumbnails instead of the image in the associated post. Would some code like this work? where it looks for the image attached in the post?
Code:
function get_social_img() {
global $post;
if ( is_single ()){
$image = wp_get_attachment_image($attachment_id, $size='full', $icon = false);
?>
<link rel="image_src" href="<?php echo $image; ?>" />
<?
}
}
add_action('wp_head', 'get_social_img');
|
#13
Aug 4, 2010, 02:26 PM
|
|
I tried the second code block posted by Flynn, without success. I made sure that it referenced my domain. Am I missing something obvious? (I'm a newbie so sometimes it goes over my head) Do I need to make sure the image is named the number of the post for it to work?
|
#14
Aug 5, 2010, 06:53 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
wadams92101 - did you try the code from post 11
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#15
Sep 18, 2010, 10:16 AM
|
|
Hi. I've tried several of these codes on my site, and am not having luck. Whenever you click the Facebook Like button at the end of my posts, for some reason, the Twitter Logo shows up as the featured image for all my posts -- whether my post contains an image or not.
My site is www.genwithag.com
My theme is ATO 3.4.9
WP 3.0.1
Can someone walk me through how I might rectify this?
thanks
Gen
|
|