• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_get_attachment_image_src函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_get_attachment_image_src函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_get_attachment_image_src函数的具体用法?PHP wp_get_attachment_image_src怎么用?PHP wp_get_attachment_image_src使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: charity_vc_our_mission

function charity_vc_our_mission($atts, $content = null)
{
    extract(shortcode_atts(array('our_mission' => ''), $atts));
    $page_id = get_page_by_title($our_mission);
    $missionQuery = new WP_Query(array("page_id" => $page_id->ID));
    if ($missionQuery->have_posts()) {
        $missionQuery->the_post();
        $url = wp_get_attachment_image_src(get_post_thumbnail_id($page_id->ID), array(1143, 479));
        ?>
        <!-- Save Lives Section Start Here-->
        <section class="save-lives text-center parallax" style="background-image: url('<?php 
        echo esc_url($url[0]);
        ?>
')">
            <div class="container">
                <div class="row">
                    <div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
                        <header class="page-header">
                            <h2><?php 
        the_title();
        ?>
</h2>
                            <?php 
        the_content();
        ?>
                        </header>
                    </div>
                </div>
            </div>
        </section>
        <!-- Save Lives Section Start Here-->
    <?php 
    }
    wp_reset_postdata();
}
开发者ID:kautzar,项目名称:drpp4,代码行数:35,代码来源:our-mission.php


示例2: processData

 function processData($atts)
 {
     $per_row = $atts['gallery_row_amount'];
     $col = (int) (12 / $per_row);
     $atts['col'] = $col;
     $atts['per_row'] = $per_row;
     $gallery_items = vc_param_group_parse_atts($atts['gallery_items']);
     $atts['amount'] = count($gallery_items);
     $i = 0;
     $items = array();
     foreach ($gallery_items as $item) {
         $items[$i]['id'] = self::GenerateId();
         // Headline
         $headline = self::Exists($item['headline'], '');
         $items[$i]['headline'] = $headline;
         // Image
         $attachment = wp_get_attachment_image_src($item['image'], 'full');
         $image_url = $attachment[0];
         $items[$i]['image_url'] = $image_url;
         // Text
         $text = self::Exists($item['text'], '');
         $items[$i]['image_text'] = $text;
         ++$i;
     }
     $atts['items'] = $items;
     return $atts;
 }
开发者ID:sebjon-bytbil,项目名称:BB.CMS,代码行数:27,代码来源:gallery.php


示例3: details

 public function details($size)
 {
     if (!isset($this->sizes[$size])) {
         $this->sizes[$size] = wp_get_attachment_image_src($this->id, $size);
     }
     return $this->sizes[$size];
 }
开发者ID:phankimi,项目名称:WP-Controllers,代码行数:7,代码来源:Picture.php


示例4: thb_teammember

function thb_teammember($atts, $content = null)
{
    extract(shortcode_atts(array('image' => '', 'name' => '', 'position' => '', 'text' => '', 'advanced' => false, 'facebook' => '', 'twitter' => '', 'pinterest' => '', 'linkedin' => ''), $atts));
    $out = '';
    $img_id = preg_replace('/[^\\d]/', '', $image);
    $img = wp_get_attachment_image_src($img_id, 'full');
    $resized = aq_resize($img[0], 320, 340, true, false, true);
    $out .= '<aside class="team_member">';
    $out .= '<figure class="fresco">';
    $out .= '<img src="' . $resized[0] . '" width="' . $resized[1] . '" height="' . $resized[2] . '" alt="' . $name . '" />';
    $out .= '<div class="overlay"><div class="buttons ' . ($advanced ? 'advanced' : '') . '">';
    $out .= $name ? '<h5>' . $name . '</h5>' : '';
    $out .= $position ? '<h6>' . $position . '</h6>' : '';
    if ($facebook || $pinterest || $twitter || $linkedin) {
        $out .= '<div class="social_links">';
        if ($facebook) {
            $out .= '<a href="' . $facebook . '" class="facebook"><i class="fa fa-facebook"></i></a>';
        }
        if ($twitter) {
            $out .= '<a href="' . $twitter . '" class="twitter"><i class="fa fa-twitter"></i></a>';
        }
        if ($pinterest) {
            $out .= '<a href="' . $pinterest . '" class="pinterest"><i class="fa fa-pinterest"></i></a>';
        }
        if ($linkedin) {
            $out .= '<a href="' . $linkedin . '" class="linkedin"><i class="fa fa-linkedin"></i></a>';
        }
        $out .= '</div>';
    }
    $out .= '</div></div>';
    $out .= '</figure>';
    $out .= '</aside>';
    return $out;
}
开发者ID:developmentDM2,项目名称:CZND,代码行数:34,代码来源:thb_teammember.php


示例5: get_thumb_urlfull

function get_thumb_urlfull($postID)
{
    $image_id = get_post_thumbnail_id($post);
    $image_url = wp_get_attachment_image_src($image_id, 'large');
    $image_url = $image_url[0];
    return $image_url;
}
开发者ID:TheProjecter,项目名称:mway,代码行数:7,代码来源:functions.php


示例6: vr_set_featured_background

function vr_set_featured_background()
{
    $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), full, false);
    if ($image_url[0]) {
        ?>
     <style>
     
       html,body {
       height:100%;
       margin:0!important;
       }
       body {
       background: url(<?php 
        echo $image_url[0];
        ?>
) #000 center top;
       background-size: contain;
       height: 100vh;
       }
       @media all and (max-width: 940px) {
        body {
          height: auto;
          background-size: cover;
          background-position: center top;
        }
      }
     </style>
   <?php 
    }
    //end if statement
}
开发者ID:jsalvino,项目名称:theme-jas,代码行数:31,代码来源:page-home.php


示例7: get_src

function get_src($image, $size)
{
    $upload_url = wp_upload_dir();
    $upload_url = $upload_url['baseurl'];
    $src = wp_get_attachment_image_src($image->ID, $size);
    return $src[0];
}
开发者ID:wsander3,项目名称:Pipe-Dream,代码行数:7,代码来源:get-photos.php


示例8: get_widget

 /**
  * Render the widget in frontend
  *
  * @param array $args
  * @param array $instance
  * @return string
  */
 function get_widget($args, $instance)
 {
     extract(wp_parse_args($instance, array('align' => '', 'animation' => '', 'class' => '', 'style' => '', 'size' => '')));
     if (is_admin()) {
         return "<center><i class='icon-picture  icon-4x'></i></center>";
     }
     if (!empty($image['url'])) {
         if ($animation != "no-animation") {
             $class = "image animated_image animate_when_visible " . $animation;
         }
         $link = get_url($link);
         if ($image['id'] > 0 && $size != '') {
             $img = wp_get_attachment_image_src($image['id'], $size);
             $use_image = " src='{$img[0]}' width='{$img[1]}' height='{$img[2]}' ";
         } else {
             $img = $image['url'];
             $use_image = " src='{$img}' ";
         }
         if ($link) {
             $output = "<a href='" . $link . "' ><img class='img-responsive {$align} {$class} {$style}'  data-animation='" . esc_attr($animation) . "' {$use_image} alt='' /></a>";
         } else {
             $output = "<img class='img-responsive {$align} {$class} {$style}' ' data-animation='" . esc_attr($animation) . "' alt='' {$use_image} />";
         }
     }
     return $output;
 }
开发者ID:tharindulucky,项目名称:premium-demo,代码行数:33,代码来源:image.php


示例9: html

 /**
  * Get field HTML
  *
  * @param string $html
  * @param mixed  $meta
  * @param array  $field
  *
  * @return string
  */
 static function html($html, $meta, $field)
 {
     global $wpdb;
     $i18n_msg = _x('Uploaded files', 'image upload', RWMB_TEXTDOMAIN);
     $i18n_del_file = _x('Delete this file', 'image upload', RWMB_TEXTDOMAIN);
     $i18n_delete = _x('Delete', 'image upload', RWMB_TEXTDOMAIN);
     $i18n_edit = _x('Edit', 'image upload', RWMB_TEXTDOMAIN);
     $i18n_title = _x('Upload files', 'image upload', RWMB_TEXTDOMAIN);
     $i18n_more = _x('Add another file', 'image upload', RWMB_TEXTDOMAIN);
     $html = wp_nonce_field("rwmb-delete-file_{$field['id']}", "nonce-delete-file_{$field['id']}", false, false);
     $html .= wp_nonce_field("rwmb-reorder-images_{$field['id']}", "nonce-reorder-images_{$field['id']}", false, false);
     $html .= "<input type='hidden' class='field-id' value='{$field['id']}' />";
     // Uploaded images
     if (!empty($meta)) {
         $html .= "<h4>{$i18n_msg}</h4>";
         $html .= "<ul class='rwmb-images rwmb-uploaded'>";
         foreach ($meta as $image) {
             $src = wp_get_attachment_image_src($image, 'thumbnail');
             $src = $src[0];
             $link = get_edit_post_link($image);
             $html .= "<li id='item_{$image}'>\n\t\t\t\t\t\t<img src='{$src}' />\n\t\t\t\t\t\t<div class='rwmb-image-bar'>\n\t\t\t\t\t\t\t<a title='{$i18n_edit}' class='rwmb-edit-file' href='{$link}' target='_blank'>{$i18n_edit}</a> |\n\t\t\t\t\t\t\t<a title='{$i18n_del_file}' class='rwmb-delete-file' href='#' rel='{$image}'>{$i18n_delete}</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</li>";
         }
         $html .= '</ul>';
     }
     // Show form upload
     $html .= "\n\t\t\t<h4>{$i18n_title}</h4>\n\t\t\t<div class='new-files'>\n\t\t\t\t<div class='file-input'><input type='file' name='{$field['id']}[]' /></div>\n\t\t\t\t<a class='rwmb-add-file' href='#'>{$i18n_more}</a>\n\t\t\t</div>";
     return $html;
 }
开发者ID:hunghoang179,项目名称:sitenews,代码行数:37,代码来源:image.php


示例10: generate_image_filed

function generate_image_filed($title, $id, $name, $value, $class, $name_btn, $class_btn)
{
    $out_filed = '';
    $out_filed .= '<tr valign="top">';
    $out_filed .= '<th scope="row">' . esc_attr($title) . '</th>';
    $out_filed .= '<td>';
    $out_filed .= '<filedset>';
    $out_filed .= '<input type="hidden" id="' . esc_attr($id) . '" name="lib_options[' . $name . ']" value="' . esc_attr($value) . '" />';
    $out_filed .= '<div class="img-container">';
    $url = '';
    if ($value != '') {
        $image = wp_get_attachment_image_src($value, 'full');
        $url = esc_url($image[0]);
    }
    $out_filed .= '<div class="' . esc_attr($class) . '" style="background-image:url(' . $url . ')">';
    if ($value) {
        $out_filed .= '<input class="button button-primary delete-img remove" type="button" value="x" />';
    }
    $out_filed .= '</div>';
    $out_filed .= '<input type="button" class="' . esc_attr($class_btn) . '" value="' . esc_attr($name_btn) . '"/>';
    $out_filed .= '</div>';
    $out_filed .= '</filedset>';
    $out_filed .= '</td>';
    $out_filed .= '</tr>';
    echo $out_filed;
}
开发者ID:Ezyva2015,项目名称:money101.com.au,代码行数:26,代码来源:functions.php


示例11: al_portfolio_meta_tags

function al_portfolio_meta_tags()
{
    $post_type = get_post_type();
    if ('portfolio' == $post_type) {
        $title = get_post_meta(get_the_ID(), "al_pf_og_title", TRUE);
        $title = !empty($title) ? $title : get_the_title();
        $meta = array('og:title' => $title, 'og:url' => get_permalink());
        $desc = get_post_meta(get_the_ID(), "al_pf_og_description", TRUE);
        $desc = !empty($desc) ? $desc : false;
        if ($desc) {
            $meta['og:description'] = $desc;
        }
        if (has_post_thumbnail()) {
            $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $meta['og:image'] = $thumbnail[0];
        }
        if (get_post_format() == 'gallery') {
            $images = rwmb_meta('al_pf_gallery_images', 'type=image&size=full');
            if (is_array($images)) {
                foreach ($images as $image) {
                    $meta['images'][] = $image['url'];
                }
            }
        }
        foreach ($meta as $key => $value) {
            if ($key == 'images') {
                foreach ($value as $image) {
                    echo '<meta property="og:image" content="' . $image . '" />';
                }
            } else {
                echo '<meta property="' . $key . '" content="' . $value . '" />';
            }
        }
    }
}
开发者ID:azeemgolive,项目名称:thefunkidsgame,代码行数:35,代码来源:artless-portfolio.php


示例12: get_image_url

function get_image_url()
{
    $image_id = get_post_thumbnail_id();
    $image_url = wp_get_attachment_image_src($image_id, 'large');
    $image_url = $image_url[0];
    echo $image_url;
}
开发者ID:pallid,项目名称:Bodriy,代码行数:7,代码来源:functions.php


示例13: largo_get_avatar_src

function largo_get_avatar_src($id_or_email, $size)
{
    $avatar_id = largo_get_user_avatar_id($id_or_email);
    if (empty($avatar_id)) {
        return false;
    }
    global $_wp_additional_image_sizes;
    $copy = $_wp_additional_image_sizes;
    usort($copy, function ($a, $b) {
        return $a['width'] - $b['width'];
    });
    $square_image_sizes = array_filter($copy, function ($arg) {
        return $arg['width'] / $arg['height'] == 1;
    });
    $requested_size = array($size, $size);
    foreach ($square_image_sizes as $key => $val) {
        if (round((double) ($val['width'] / $val['height']), 1, PHP_ROUND_HALF_DOWN) == round((double) ($requested_size[0] / $requested_size[1]), 1, PHP_ROUND_HALF_DOWN)) {
            // Try to find an image size equal to or just slightly larger than what was requested
            if ($val['width'] >= $requested_size[0]) {
                $requested_size = array($val['width'], $val['height']);
                break;
            }
            // If we can't find an image size, set the requested size to the largest of the
            // square sizes available
            if (end($square_image_sizes) == $square_image_sizes[$key]) {
                $requested_size = array($val['width'], $val['height']);
            }
        }
    }
    return wp_get_attachment_image_src($avatar_id, $requested_size);
}
开发者ID:NathanLawrence,项目名称:Largo,代码行数:31,代码来源:functions.php


示例14: degrona15_add_candidate_content

function degrona15_add_candidate_content()
{
    if (is_front_page()) {
        // If De_Grona_Ehdokas-plugin is installed, retrieve $instance of the plugin
        if (function_exists('De_Grona_Ehdokas')) {
            $instance = De_Grona_Ehdokas::instance();
            if ($instance->get_candidate_data('degrona15_candidate_enable_home_page')) {
                $bg_img_id = $instance->get_candidate_data('degrona15_candidate_site_jumbotron');
                if ($bg_img_id) {
                    $bg_img = wp_get_attachment_image_src($bg_img_id, 'full');
                } else {
                    $bg_img[0] = $instance->get_jumbtoron_default_bg();
                }
                $data = $instance->get_candidate_home_page_data();
                ?>

        <div class='de_grona_candidate_jumbotron' style='background-image: url(<?php 
                echo $bg_img[0];
                ?>
);'>
          <!-- <div class='row'> -->
          <?php 
                echo $data;
                ?>
          <!-- </div> -->
        </div>
      <?php 
            }
        }
    }
}
开发者ID:0is1,项目名称:degrona15,代码行数:31,代码来源:functions.php


示例15: get_full_img_src

 /**
  * Full attachment image url.
  *
  * Gets a post ID and returns the url for the 'full' size of the attachment
  * set as featured image.
  * 
  * @param  int $id 	 The post ID.
  * @since  1.5.9
  * @return string    The featured image url for the 'full' size.
  */
 public function get_full_img_src($id)
 {
     $thumb_id = get_post_thumbnail_id($id);
     $size = isset($this->settings->thumb_size) ? $this->settings->thumb_size : 'medium';
     $img = wp_get_attachment_image_src($thumb_id, $size);
     return $img[0];
 }
开发者ID:onedaylabs,项目名称:onedaylabs.com,代码行数:17,代码来源:post-slider.php


示例16: wm_logo

 function wm_logo()
 {
     //Helper variables
     $output = '';
     $blog_info = apply_filters('wmhook_wm_logo_blog_info', array('name' => trim(get_bloginfo('name')), 'description' => trim(get_bloginfo('description'))));
     $args = apply_filters('wmhook_wm_logo_args', array('title_att' => $blog_info['description'] ? $blog_info['name'] . ' | ' . $blog_info['description'] : $blog_info['name'], 'logo_image' => function_exists('jetpack_get_site_logo') ? absint(jetpack_get_site_logo('id')) : false, 'logo_type' => 'text', 'url' => home_url('/')));
     //Preparing output
     //Logo image
     if (!empty($args['logo_image'])) {
         $img_id = is_numeric($args['logo_image']) ? absint($args['logo_image']) : wm_get_image_id_from_url($args['logo_image']);
         if ($img_id) {
             $logo_url = wp_get_attachment_image_src($img_id, 'full');
             $atts = (array) apply_filters('wmhook_wm_logo_image_atts', array('alt' => esc_attr(sprintf(_x('%s logo', 'Site logo image "alt" HTML attribute text.', 'wm_domain'), $blog_info['name'])), 'title' => esc_attr($args['title_att']), 'class' => ''));
             $args['logo_image'] = wp_get_attachment_image($img_id, 'full', false, $atts);
         }
         $args['logo_type'] = 'img';
     }
     $args['logo_image'] = apply_filters('wmhook_wm_logo_logo_image', $args['logo_image']);
     //Logo HTML
     $output .= '<div class="site-branding">';
     $output .= '<h1 class="' . apply_filters('wmhook_wm_logo_class', 'site-title logo type-' . $args['logo_type'], $args) . '">';
     $output .= '<a href="' . esc_url($args['url']) . '" title="' . esc_attr($args['title_att']) . '">';
     if ('text' === $args['logo_type']) {
         $output .= '<span class="text-logo">' . $blog_info['name'] . '</span>';
     } else {
         $output .= $args['logo_image'];
     }
     $output .= '</a></h1>';
     if ($blog_info['description']) {
         $output .= '<h2 class="site-description">' . $blog_info['description'] . '</h2>';
     }
     $output .= '</div>';
     //Output
     echo apply_filters('wmhook_wm_logo_output', $output);
 }
开发者ID:un1coin,项目名称:ovn-space,代码行数:35,代码来源:core.php


示例17: rs_option_page_new

function rs_option_page_new()
{
    $slider = new WP_Query(array('post_type' => 'slideshow', 'order' => 'ASC'));
    if ($slider->have_posts()) {
        ?>

		<ul class="bxslider">
			<?php 
        while ($slider->have_posts()) {
            $slider->the_post();
            ?>
				<li>
					<?php 
            $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
            $url = $thumb['0'];
            ?>
					<img src="<?php 
            echo $url;
            ?>
" title="<?php 
            the_content();
            ?>
">
				</li>
			<?php 
        }
        ?>
		</ul>
	<?php 
    } else {
        ?>
		<div><h2>This plase slider</h2></div>
	<?php 
    }
}
开发者ID:web-user,项目名称:plugin_test,代码行数:35,代码来源:plugin_test.php


示例18: testResizedByArray

 function testResizedByArray()
 {
     $image = wp_get_attachment_image_src($this->attachment, array(300, 300));
     $this->assertEquals(300, $image[1]);
     $this->assertEquals(242, $image[2]);
     $this->assertTrue((bool) strpos($image[0], '/cache/'));
 }
开发者ID:bjornjohansen,项目名称:WPThumb,代码行数:7,代码来源:imageSizesTest.php


示例19: hoot_get_image_size_links

/**
 * Returns a set of image attachment links based on size.
 *
 * @since 1.0.0
 * @access public
 * @return string
 */
function hoot_get_image_size_links()
{
    /* If not viewing an image attachment page, return. */
    if (!wp_attachment_is_image(get_the_ID())) {
        return;
    }
    /* Set up an empty array for the links. */
    $links = array();
    /* Get the intermediate image sizes and add the full size to the array. */
    $sizes = get_intermediate_image_sizes();
    $sizes[] = 'full';
    /* Loop through each of the image sizes. */
    foreach ($sizes as $size) {
        /* Get the image source, width, height, and whether it's intermediate. */
        $image = wp_get_attachment_image_src(get_the_ID(), $size);
        /* Add the link to the array if there's an image and if $is_intermediate (4th array value) is true or full size. */
        if (!empty($image) && (true === $image[3] || 'full' == $size)) {
            /* Translators: Media dimensions - 1 is width and 2 is height. */
            $label = sprintf(__('%1$s &#215; %2$s', 'chromatic'), number_format_i18n(absint($image[1])), number_format_i18n(absint($image[2])));
            $links[] = sprintf('<a class="image-size-link">%s</a>', $label);
        }
    }
    /* Join the links in a string and return. */
    return join(' <span class="sep">/</span> ', $links);
}
开发者ID:acafourek,项目名称:maidstone,代码行数:32,代码来源:template-media.php


示例20: sys_recent_posts

function sys_recent_posts($atts, $content = null)
{
    extract(shortcode_atts(array('limit' => '2', 'description' => '40', 'cat_id' => '23', 'thumb' => 'true', 'postdate' => ''), $atts));
    $out = '<div class="widget_postslist sc">';
    $out .= '<ul>';
    global $wpdb;
    $myposts = get_posts("numberposts={$limit}&offset=0&cat={$cat_id}");
    foreach ($myposts as $post) {
        $post_date = $post->post_date;
        $post_date = mysql2date('F j, Y', $post_date, false);
        $out .= "<li>";
        if ($thumb == "true") {
            $thumbid = get_post_thumbnail_id($post->ID);
            $imgsrc = wp_get_attachment_image_src($thumbid, array(9999, 9999));
            $out .= '<div class="thumb"><a href="' . get_permalink($post->ID) . '" title="' . $post->post_title . '">';
            if ($thumbid) {
                $out .= atp_resize('', $imgsrc['0'], '50', '50', 'imgborder', '');
            } else {
                //$out .= '<img class="imgborder" src="'.THEME_URI.'/images/no-image.jpg'.'"  alt="' .$post->post_title. '" />';
            }
            $out .= '</a></div>';
        }
        $out .= '<div class="pdesc"><a href="' . get_permalink($post->ID) . '" rel="bookmark">' . $post->post_title . '</a>';
        if ($postdate == "true") {
            $out .= '<div class="w-postmeta"><span>' . $post_date . '</span></div>';
        } else {
            $out .= '<p>' . wp_html_excerpt($post->post_content, $description, '...') . '</p>';
        }
        $out .= '</div></li>';
    }
    $out .= '</ul></div>';
    return $out;
    wp_reset_query();
}
开发者ID:pryspry,项目名称:MusicPlay,代码行数:34,代码来源:recentposts.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_get_attachment_image_srcset函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_get_attachment_image_sizes函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap