Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

Can Atahualpa do this? Define the image for Facebook links?


  #1  
Old Dec 1, 2009, 11:08 PM
adum's Avatar
adum
 
85 posts · Jun 2009
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.

Last edited by adum; Dec 7, 2009 at 10:01 AM.
  #2  
Old Dec 7, 2009, 11:08 AM
Flynn's Avatar
Flynn
 
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  
Old Dec 8, 2009, 01:03 PM
adum's Avatar
adum
 
85 posts · Jun 2009
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  
Old Apr 14, 2010, 08:52 AM
anthonyportal
 
4 posts · Apr 2010
Hi
May i know , does the code above work for other wordpress themes.


Thank you.
Best regards
Anthony

  #5  
Old Apr 14, 2010, 12:43 PM
viewdesigninc
 
35 posts · Mar 2009
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  
Old Apr 15, 2010, 12:44 PM
anthonyportal
 
4 posts · Apr 2010
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 12:46 PM.

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Share Post on FaceBook without any use of plugins (( Atahualpa )) irvin Atahualpa 3 Wordpress theme 5 Dec 18, 2010 06:04 AM
Facebook Badge winemuse Sidebars & Widgets 4 Nov 20, 2009 12:34 AM
Problems With Facebook Sharing iLeonardo Post-Kicker, -Byline & -Footer 6 Oct 7, 2009 02:00 AM
Is Facebook Profitable? Ahsen New Versions, & Updating 1 Jul 7, 2009 07:10 AM
Difficulties to define a navigation estructure ahc Page & Category Menu Bars 0 Jun 8, 2009 09:21 AM


All times are GMT -6. The time now is 03:16 PM.


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