Unique Image Settings

Facebook Share thumb integration

', __('Favicon Thumb', 'unique_image'), ''; ?>
/>
<?php _e('Facebook usage', 'unique_image'); ?>

Example of integration with your template

  1. Open your template file e.g. /wp-content/themes/your_theme_name/single.php
  2. Add into LOOP that code <?php if (function_exists('headline_image_show')) headline_image_show(); ?>
$image_title EOF; printf($context, $out); } function headline_image_meta_box($post) { global $post_ID, $temp_ID; $image_ID = get_post_meta($post_ID, '_headline_image', true); echo ''; ?>

id="headline_image_remove"> no image, '' => form not exists, 1,2,... => id of image) if ($_POST['headline_image_value'] != '') update_post_meta($post_ID, '_headline_image', intval($_POST['headline_image_value'])); } function headline_image_show($post_ID = 0) { global $post; // if $post_ID is not setted (for special purposes), use normal ID from global variable if (!$post_ID) $post_ID = $post->ID; $attachment_id = get_post_meta($post_ID, '_headline_image', true); // use alternate text for image (if it is setted) echo wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, array('alt' => get_post_meta($attachment_id, '_wp_attachment_image_alt', true))); } /*********** FACEBOOK SUPPORT *************/ // add meta to header if facebook support is enabled if ($options['facebook']) add_action('wp_head', 'headline_image_facebook_meta'); // show meta () in function headline_image_facebook_meta() { global $wp_query; // only for single post if (is_single()) { $thePostID = $wp_query->post->ID; $image = wp_get_attachment_image_src(get_post_meta($thePostID, '_headline_image', true)); $image = $image[0]; } // get default image (setted in administration), when $image does not exists (page is not Single or there is no Unique image for article) if (!$image && headline_image_valid_url(get_option('_unique_image_facebook_default'))) $image = get_option('_unique_image_facebook_default'); echo ''; } /*********** FACEBOOK SUPPORT *************/ function headline_image_valid_url($url) { return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url); } ?>