Results 1 to 8 of 8
-
21st Oct 2011, 09:35 AM #1OPMember
Where can I insert this code?
Hello guys,
Im trying to make this facebook trick in my blog:
http://capturingyourmarket.com/socia...facebook-page/
But dont know where I can add the code below in my theme:
In your WordPress menu, go to Appearance -> Editor. In the right side you will see a list of the various pages and parts of your WordPress theme. Click on the Header file to open it for editing.
Between the <head>...</head> tags copy and paste the following code.
PHP Code:<?php if(is_single()) { ?> <?php // Featured Image for FB Like $feature_image = get_the_post_thumbnail($post->ID); // Get image source $doc = new DOMDocument(); $doc->loadHTML($feature_image); $imageTags = $doc->getElementsByTagName('img'); foreach($imageTags as $tag) { $image_url = $tag->getAttribute('src'); } ?> <link rel="image_src" href="<?php echo $image_url; ?>" /> <?php } ?>
Another option is to edit a social plugin that I have installed in my blog called Tweet, Like, Google +1 and Share.
In that plugin file tweet-like-plusone.php I have this code that appears beteween the <head> and </head:
Code:if(is_single() || is_page()) { ?> <meta property="og:type" content="article" /> <meta property="og:title" content="<?php single_post_title(''); ?> | www.estapessoa.com" /> <meta property="og:description" content="Se pensas o mesmo, clica em PARTILHAR para colocares no teu mural e mostrar aos teus amigos! Visita a nossa p?gina e clica em GOSTO para ficares a par das frases do momento: http://www.facebook.com/estapessoa" /> <meta property="og:url" content="<?php the_permalink(); ?>"/> <?php if(trim($thumb)!=''){ ?> <meta property="og:image" content="<?php echo $thumb; ?>" /> <?php } ?> <?php } else { ?> <meta property="og:type" content="article" /> <meta property="og:title" content="<?php bloginfo('name'); ?>" /> <meta property="og:url" content="<?php bloginfo('url'); ?>"/> <meta property="og:description" content="Se pensas o mesmo, clica em PARTILHAR para colocares no teu mural e mostrar aos teus amigos! Visita a nossa p?gina e clica em GOSTO para ficares a par das frases do momento: http://www.facebook.com/estapessoa" /> <?php if(trim($default_img)!=''){ ?> <meta property="og:image" content="<?php echo $default_img; ?>" /> <?php } ?> <?php } }
Divvy Reviewed by Divvy on . Where can I insert this code? Hello guys, Im trying to make this facebook trick in my blog: http://capturingyourmarket.com/social-media/customize-your-business-facebook-page/ But dont know where I can add the code below in my theme: I know that I need to insert at header.php but my theme is a little different. Im using a theme called "Gallery" (theme by UpThemes) that are working with the Thematic child theme. Can someone help me with that please? Rating: 5
-
21st Oct 2011, 09:56 AM #2MemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comtry this:
Code:if(is_single() || is_page()) { ?> <meta property="og:type" content="article" /> <meta property="og:title" content="<?php single_post_title(''); ?> | www.estapessoa.com" /> <meta property="og:description" content="Se pensas o mesmo, clica em PARTILHAR para colocares no teu mural e mostrar aos teus amigos! Visita a nossa p?gina e clica em GOSTO para ficares a par das frases do momento: http://www.facebook.com/estapessoa" /> <meta property="og:url" content="<?php the_permalink(); ?>"/> <?php if(trim($thumb)!=''){ ?> <meta property="og:image" content="<?php echo $thumb; ?>" /> <?php } ?> <?php } else { ?> <meta property="og:type" content="article" /> <meta property="og:title" content="<?php bloginfo('name'); ?>" /> <meta property="og:url" content="<?php bloginfo('url'); ?>"/> <meta property="og:description" content="Se pensas o mesmo, clica em PARTILHAR para colocares no teu mural e mostrar aos teus amigos! Visita a nossa p?gina e clica em GOSTO para ficares a par das frases do momento: http://www.facebook.com/estapessoa" /> <?php if(trim($default_img)!=''){ ?> <meta property="og:image" content="<?php echo $default_img; ?>" /> <?php } ?> <?php } ?> <?php if(is_single()) { ?> <?php // Featured Image for FB Like $feature_image = get_the_post_thumbnail($post->ID); // Get image source $doc = new DOMDocument(); $doc->loadHTML($feature_image); $imageTags = $doc->getElementsByTagName('img'); foreach($imageTags as $tag) { $image_url = $tag->getAttribute('src'); } ?> <link rel="image_src" href="<?php echo $image_url; ?>" /> <?php } ?>
-
21st Oct 2011, 09:58 AM #3OPMember
Thank you for your reply mate!
But already found the </head> in the thematic theme and added the code above.
Is working and grab the image correctly, but the trick didn't work
Does anyone confirm that? Anyone use or test this trick?
-
21st Oct 2011, 10:04 AM #4MemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comcheck my previous post again, some lines were commented
-
21st Oct 2011, 10:13 AM #5OPMember
ohh sorry, I will try!
hmmm gives me an error:
Parse error: syntax error, unexpected '}' in /home/test123/public_html/wp-content/plugins/only-tweet-like-share-and-google-1/tweet-like-plusone.php on line 357
-
21st Oct 2011, 10:25 AM #6Member
looks like theres an additional '}' which shouldn't be there.
try to change this:
<meta property="og:image" content="<?php echo $default_img; ?>" />
<?php } ?>
<?php }
} ?>
<?php if(is_single()) { ?>
<meta property="og:image" content="<?php echo $default_img; ?>" />
<?php } ?>
<?php } ?>
<?php if(is_single()) { ?>
-
21st Oct 2011, 10:27 AM #7MemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comcheck my post again, was an extra }
-
21st Oct 2011, 10:29 AM #8OPMember
worst... too many errors like that lol
EDIT: (final error
Fatal error: Call to undefined function disp_social_on_optionpage() in /home/pessoa/public_html/wp-content/plugins/only-tweet-like-share-and-google-1/tweet-like-plusone.php on line 234
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
MySQL insert using PHP Help
By EnCiPh3r in forum Web Development AreaReplies: 9Last Post: 13th Jan 2012, 11:10 PM -
which the code to insert flash player?
By ctoveloz in forum Webmaster DiscussionReplies: 1Last Post: 20th Oct 2011, 07:20 PM -
insert PSD file
By iobit in forum vBulletinReplies: 10Last Post: 9th Aug 2011, 08:38 AM -
Insert Image Code
By warezboy in forum vBulletinReplies: 12Last Post: 9th Jun 2010, 06:16 PM -
Insert Image CODE
By tom247 in forum Web Application/Script SupportReplies: 3Last Post: 9th Jun 2010, 05:04 AM
themaManager - edit and manage...
Version 4.04 released. Open older version (or...