コード例 #1
0
function get_aq_resize_img_full($thumbnail_size)
{
    $thumb = get_post_thumbnail_id();
    if ($thumb != "") {
        $img_url = wp_get_attachment_url($thumb, $thumbnail_size);
        $image = $img_url;
        return "<img alt='" . get_the_title() . "' src='" . $image . "'>";
    } else {
        return "<img alt='" . get_the_title() . "' src='" . vpanel_image() . "'>";
    }
}
コード例 #2
0
ファイル: functions.php プロジェクト: bunnywong/freshlinker
function vbegy_head()
{
    global $post;
    $default_favicon = get_template_directory_uri() . "/images/favicon.png";
    if (vpanel_options("favicon")) {
        echo '<link rel="shortcut icon" href="' . vpanel_options("favicon") . '" type="image/x-icon">' . "\n";
    }
    /* Favicon iPhone */
    if (vpanel_options("iphone_icon")) {
        echo '<link rel="apple-touch-icon-precomposed" href="' . vpanel_options("iphone_icon") . '">' . "\n";
    }
    /* Favicon iPhone 4 Retina display */
    if (vpanel_options("iphone_icon_retina")) {
        echo '<link rel="apple-touch-icon-precomposed" sizes="114x114" href="' . vpanel_options("iphone_icon_retina") . '">' . "\n";
    }
    /* Favicon iPad */
    if (vpanel_options("ipad_icon")) {
        echo '<link rel="apple-touch-icon-precomposed" sizes="72x72" href="' . vpanel_options("ipad_icon") . '">' . "\n";
    }
    /* Favicon iPad Retina display */
    if (vpanel_options("ipad_icon_retina")) {
        echo '<link rel="apple-touch-icon-precomposed" sizes="144x144" href="' . vpanel_options("ipad_icon_retina") . '">' . "\n";
    }
    /* Seo */
    $the_seo = stripslashes(vpanel_options("the_keywords"));
    if (vpanel_options("seo_active") == 1) {
        $fbShareImage = get_option('fb_share_image');
        echo '<meta property="og:site_name" content="' . htmlspecialchars(get_bloginfo('name')) . '" />' . "\n";
        echo '<meta property="og:type" content="website" />' . "\n";
        if (is_single() || is_page()) {
            wp_reset_query();
            if (have_posts()) {
                while (have_posts()) {
                    the_post();
                    $vpanel_image = vpanel_image();
                    if (function_exists("has_post_thumbnail") && has_post_thumbnail() || !empty($vpanel_image)) {
                        if (has_post_thumbnail()) {
                            $image_id = get_post_thumbnail_id($post->ID);
                            $image_url = wp_get_attachment_image_src($image_id, "vbegy_img_8");
                            $post_thumb = $image_url[0];
                        } else {
                            $post_thumb = $vpanel_image;
                        }
                    } else {
                        $protocol = is_ssl() ? 'https' : 'http';
                        $video_id = rwmb_meta('vbegy_video_post_id', "select", $post->ID);
                        $video_type = rwmb_meta('vbegy_video_post_type', "text", $post->ID);
                        if (is_singular("question")) {
                            $video_id = get_post_meta($post->ID, 'video_id', true);
                            $video_type = get_post_meta($post->ID, 'video_type', true);
                        }
                        if (!empty($video_id)) {
                            if ($video_type == 'youtube') {
                                $post_thumb = $protocol . '://img.youtube.com/vi/' . $video_id . '/0.jpg';
                            } else {
                                if ($video_type == 'vimeo') {
                                    $video_url = $get_meta['video'];
                                    $url = $protocol . '://vimeo.com/api/v2/video/' . $video_id . '.php';
                                    $contents = @file_get_contents($url);
                                    $thumb = @unserialize(trim($contents));
                                    $post_thumb = $thumb[0]['thumbnail_large'];
                                } elseif ($video_type == 'daily') {
                                    $video_url = $get_meta['video'];
                                    $post_thumb = 'http://www.dailymotion.com/thumbnail/video/' . $video_id;
                                }
                            }
                        }
                    }
                    if (!empty($post_thumb)) {
                        echo '<meta property="og:image" content="' . $post_thumb . '" />' . "\n";
                    } else {
                        $fb_share_image = vpanel_options("fb_share_image");
                        $logo_display = vpanel_options("logo_display");
                        $logo_img = vpanel_options("logo_img");
                        if (!empty($fb_share_image)) {
                            echo '<meta property="og:image" content="' . $fb_share_image . '" />' . "\n";
                        } else {
                            if ($logo_display == "custom_image" && isset($logo_img) && $logo_img != "") {
                                echo '<meta property="og:image" content="' . $logo_img . '" />' . "\n";
                                ?>
    		        <?php 
                            }
                        }
                    }
                    $title = the_title('', '', false);
                    $php_version = explode('.', phpversion());
                    if (count($php_version) && $php_version[0] >= 5) {
                        $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
                    } else {
                        $title = html_entity_decode($title, ENT_QUOTES);
                    }
                    echo '<meta property="og:title" content="' . htmlspecialchars($title) . '" />' . "\n";
                    echo '<meta property="og:url" content="' . get_permalink() . '" />' . "\n";
                    $description = trim(get_the_excerpt());
                    if ($description != '') {
                        echo '<meta property="og:description" content="' . htmlspecialchars($description) . '" />' . "\n";
                    }
                    if (is_singular("question")) {
                        if ($terms = wp_get_object_terms($post->ID, 'question_tags')) {
                            $the_tags_post = '';
                            $terms_array = array();
                            foreach ($terms as $term) {
                                $the_tags_post .= $term->name . ',';
                            }
                            echo '<meta name="keywords" content="' . trim($the_tags_post, ',') . '">' . "\n";
                        }
                    } else {
                        $posttags = get_the_tags();
                        if ($posttags) {
                            $the_tags_post = '';
                            foreach ($posttags as $tag) {
                                $the_tags_post .= $tag->name . ',';
                            }
                            echo '<meta name="keywords" content="' . trim($the_tags_post, ',') . '">' . "\n";
                        }
                    }
                }
            }
            wp_reset_query();
        } else {
            $fb_share_image = vpanel_options("fb_share_image");
            $logo_display = vpanel_options("logo_display");
            $logo_img = vpanel_options("logo_img");
            if (!empty($fb_share_image)) {
                echo '<meta property="og:image" content="' . $fb_share_image . '" />' . "\n";
            } else {
                if ($logo_display == "custom_image" && isset($logo_img) && $logo_img != "") {
                    echo '<meta property="og:image" content="' . $logo_img . '" />' . "\n";
                }
            }
            echo '<meta property="og:title" content="' . get_bloginfo('name') . '" />' . "\n";
            echo '<meta property="og:url" content="' . home_url() . '" />' . "\n";
            echo '<meta property="og:description" content="' . get_bloginfo('description') . '" />' . "\n";
            echo "<meta name='keywords' content='" . $the_seo . "'>" . "\n";
        }
    }
    /* head_code */
    if (vpanel_options("head_code")) {
        echo stripslashes(vpanel_options("head_code"));
    }
}