Advertisement
MrPauloeN

Meta Dane i Meta Opisy Open Graph dla FB - gotowy kod dla WP

Mar 27th, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.12 KB | None | 0 0
  1. <!-- Meta Dane i Meta Opisy Open Graph Dla FB - Gotowy Kod Dla WordPressa -- manualnie -->
  2.     <?php if (is_home()) { ?>
  3.     <!-- if page is home -->
  4.                
  5. <meta property="og:title" content="<?php bloginfo('name'); ?>" />
  6. <meta property="og:description" content="<?php bloginfo('description'); ?>" />
  7.  
  8. <meta property="og:site_name" content="<?php bloginfo('name'); ?>">
  9. <meta property="og:url" content="<?php bloginfo('url'); ?>"/>
  10.                
  11. <meta property="og:type" content="website" />
  12. <meta property="og:image" content="<?php echo get_template_directory_uri(); ?>/images/supermen-wordpress.png" />
  13. <meta property="og:locale" content="pl_pl">
  14.            
  15.     <?php } if (is_single()) { ?>
  16.     <!-- if page is content page -->
  17. <meta property="og:title" content="<?php single_post_title(''); ?>" />
  18.  
  19. <meta property="og:description" content="<?php
  20. $description = get_post($post->ID);
  21. $description = $description->post_content;
  22. $trimmed = wp_trim_words( $description, $num_words = 55, $more = null );
  23. echo $trimmed; ?>" />
  24. <meta property="og:site_name" content="<?php bloginfo('name'); ?>">            
  25. <meta property="og:url" content="<?php the_permalink() ?>"/>               
  26. <meta property="og:type" content="article" />
  27. <meta property="og:image" content="<?php  $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
  28.                 $url = $thumb['0'];
  29.                 echo $url;?>" />
  30. <meta property="og:locale" content="pl_pl">
  31.     <?php } if (is_page()){ ?>
  32.     <!-- if page is others -->
  33. <meta property="og:title" content="<?php wp_title(); ?>" />
  34. <meta property="og:description" content="<?php echo get_post_meta($post->ID, "description", true); ?> | <?php bloginfo('description'); ?>" />
  35. <meta property="og:site_name" content="<?php bloginfo('url'); ?>" />
  36. <meta property="og:url" content="<?php the_permalink() ?>"/>               
  37. <meta property="og:type" content="website" />
  38. <meta property="og:image" content="<?php  $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
  39.                 $url = $thumb['0'];
  40.                 echo $url;?>"  />
  41. <meta property="og:locale" content="pl_pl">
  42. <?php } ?>
  43.  
  44.     <!-- End of Open Graph -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement