Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   Can Atahualpa do this? Define the image for Facebook links? (http://forum.bytesforall.com/showthread.php?t=4671)

adum Dec 1, 2009 11:08 PM

Can Atahualpa do this? Define the image for Facebook links?
 
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.

Flynn Dec 7, 2009 11:08 AM

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/

adum Dec 8, 2009 01: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. :)

anthonyportal Apr 14, 2010 08:52 AM

Hi
May i know , does the code above work for other wordpress themes.


Thank you.
Best regards
Anthony

:):)

viewdesigninc Apr 14, 2010 12: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?

anthonyportal Apr 15, 2010 12: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.

juggledad Apr 15, 2010 12:55 PM

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?

anthonyportal Apr 15, 2010 09: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

juggledad Apr 16, 2010 06:25 AM

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?

anthonyportal Apr 16, 2010 11:11 PM

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.

adum Apr 25, 2010 05: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" />
<?
}
}

jdadour Jun 21, 2010 12: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');


wadams92101 Aug 4, 2010 01: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?

juggledad Aug 5, 2010 05:53 AM

wadams92101 - did you try the code from post 11

genevieve.r.thompson Sep 18, 2010 09: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


All times are GMT -6. The time now is 03:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.