Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Logik Thumbnail Getter
- function logik_thumbnail() {
- if (is_home()) { $img_url = get_option('logik_fbimgurl'); }
- elseif(has_post_thumbnail( $post->ID )) {
- $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' );
- $img_url = $thumb['0'];
- } else {
- //function to call first uploaded image in functions file
- $files = get_children('post_parent='.get_the_ID().'&post_type=attachment
- &post_mime_type=image&order=desc');
- if($files) :
- $keys = array_reverse(array_keys($files));
- $j=0;
- $num = $keys[$j];
- $img_url=wp_get_attachment_thumb_url($num);
- endif;
- }
- if ( $img_url == '' ) {
- $img_url = get_option('logik_fbimgurl');
- }
- if ( $img_url == '' ) {
- get_option('logik_fbimgurl');
- $template=get_theme_root_uri();
- $img_url = $template .'/ThemeName/images/defaultimage.jpg';
- }
- echo $img_url;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement