本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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;
}
示例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];
}
示例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;
}
示例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;
}
示例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
}
示例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];
}
示例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;
}
示例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;
}
示例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;
}
示例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 . '" />';
}
}
}
}
示例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;
}
示例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);
}
示例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
}
}
}
}
示例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];
}