当前位置: 首页>>代码示例>>PHP>>正文


PHP wpgrade::uri方法代码示例

本文整理汇总了PHP中wpgrade::uri方法的典型用法代码示例。如果您正苦于以下问题:PHP wpgrade::uri方法的具体用法?PHP wpgrade::uri怎么用?PHP wpgrade::uri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wpgrade的用法示例。


在下文中一共展示了wpgrade::uri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wpgrade_get_socialimage

function wpgrade_get_socialimage()
{
    global $post;
    if (!empty($post)) {
        $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), '', '');
        //we use the featured-classic image id defined
        if (has_post_thumbnail($post->ID)) {
            $socialimg = $src[0];
        } elseif (is_front_page() && wpgrade::option_image_src('main_logo')) {
            //if this is the front page we get the logo if no featured-classic image is assigned
            $socialimg = wpgrade::option_image_src('main_logo');
        } else {
            // ! has_post_thumbnail and no front page
            $socialimg = '';
            preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
            if (array_key_exists(1, $matches) && array_key_exists(0, $matches[1])) {
                $socialimg = $matches[1][0];
            }
        }
        if (empty($socialimg)) {
            if (is_attachment()) {
                $temp = wp_get_attachment_image_src($post->ID, "full");
                $socialimg = $temp[0];
            } else {
                // ! is_attachement
                // try to get the first attached image
                $files = get_children('post_parent=' . $post->ID . '&post_type=attachment&post_mime_type=image&order=desc');
                if ($files) {
                    $keys = array_reverse(array_keys($files));
                    $j = 0;
                    $num = $keys[$j];
                    $image = wp_get_attachment_image($num, 'full', true);
                    $imagepieces = explode('"', $image);
                    $imagepath = $imagepieces[1];
                    $socialimg = wp_get_attachment_url($num);
                } else {
                    // ! $files (use a default image)
                    // check if we have one uploaded in the theme options
                    if (wpgrade::option_image_src('social_share_default_image')) {
                        $socialimg = wpgrade::option_image_src('social_share_default_image');
                    } else {
                        // ! social_share_default_image (use the default thumb gif)
                        $socialimg = wpgrade::uri('/assets/images/nothumb.png');
                    }
                }
            }
        }
        return $socialimg;
    } else {
        // empty $post
        return '';
    }
}
开发者ID:qhuit,项目名称:Tournesol,代码行数:53,代码来源:social-media.php

示例2: get_post_format_first_image_src

 static function get_post_format_first_image_src()
 {
     global $post;
     $first_img = '';
     ob_start();
     ob_end_clean();
     $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
     $first_img = $matches[1][0];
     if (empty($first_img)) {
         //Defines a default image
         $first_img = wpgrade::uri("/assets/img/default.jpg");
     }
     return $first_img;
 }
开发者ID:qhuit,项目名称:Tournesol,代码行数:14,代码来源:rosa.php

示例3: resourceuri

 /**
  * @return string uri to resource file
  */
 static function resourceuri($file)
 {
     return wpgrade::uri(wpgrade::confoption('resource-path', 'theme-content') . '/' . ltrim($file, '/'));
 }
开发者ID:pwzCypher,项目名称:wp-push,代码行数:7,代码来源:wpgrade.php


注:本文中的wpgrade::uri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。