本文整理汇总了PHP中get_post_gallery函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_gallery函数的具体用法?PHP get_post_gallery怎么用?PHP get_post_gallery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_post_gallery函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: add_img_tag
function add_img_tag($link)
{
if (get_post_gallery(get_the_ID())) {
return $link;
} else {
$simplemasonry_apply = get_post_meta(get_the_ID(), 'simplemasonry_apply');
if (!empty($simplemasonry_apply)) {
if ($simplemasonry_apply[0] === 'true') {
$links = NULL;
if (preg_match_all("/<a href=(.+?)><img(.+?)><\\/a>/mis", $link, $result) !== false) {
foreach ($result[0] as $value) {
$links .= '<div class="item-contents' . get_the_ID() . '">' . $value . '</div>' . "\n";
}
}
$links = '<div id="container-contents' . get_the_ID() . '" class="centered">' . "\n" . $links . '</div>' . "\n";
$this->footer_jscss_s['contents' . get_the_ID()] = $this->add_jscss('contents');
return $links;
} else {
return $link;
}
} else {
return $link;
}
}
}
开发者ID:marleexoxo,项目名称:FWC,代码行数:25,代码来源:SimpleMasonry.php
示例2: _s_truncate_gallery
/**
* Truncate gallery
*
* @link
*/
function _s_truncate_gallery($atts)
{
$atts = shortcode_atts(array('total' => -1), $atts);
$args = array('p' => get_the_id());
$query = new WP_Query($args);
if ($query->have_posts()) {
$gallery_image_ids_array = array();
while ($query->have_posts()) {
$query->the_post();
if (get_post_gallery()) {
$gallery = get_post_gallery(get_the_ID(), false);
$gallery_image_ids = explode(",", $gallery['ids']);
$c = 0;
foreach ($gallery_image_ids as $gallery_image_id) {
array_push($gallery_image_ids_array, $gallery_image_id);
if (++$c == $atts['total']) {
break;
}
}
}
}
}
$query->reset_postdata();
return implode(',', $gallery_image_ids_array);
}
开发者ID:ramiroazar,项目名称:underscores,代码行数:30,代码来源:extras.php
示例3: azeria_post_gallery
/**
* Show featured gallery for gallery post format
*/
function azeria_post_gallery()
{
$post_id = get_the_ID();
// first - try to get images from galleries in post
$post_gallery = get_post_gallery($post_id, false);
if (!empty($post_gallery['ids'])) {
$post_gallery = explode(',', $post_gallery['ids']);
} elseif (!empty($post_gallery['src'])) {
$post_gallery = $post_gallery['src'];
} else {
$post_gallery = false;
}
// if can't try to catch images inserted into post
if (!$post_gallery) {
$post_gallery = azeria_post_images($post_id, 15);
}
// and if not find any images - try to get images attached to post
if (!$post_gallery || empty($post_gallery)) {
$attachments = get_children(array('post_parent' => $post_id, 'posts_per_page' => 3, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image'));
if ($attachments && is_array($attachments)) {
$post_gallery = array_keys($attachments);
}
}
if (!$post_gallery || empty($post_gallery)) {
return false;
}
$output = azeria_get_gallery_html($post_gallery);
echo $output;
}
开发者ID:phdulac,项目名称:wordpress,代码行数:32,代码来源:template-post-formats.php
示例4: get_gallery_post
function get_gallery_post()
{
if (isset($_POST['id']) && !empty($_POST['id'])) {
$projectsCats = array('cocheras', 'terrazas', 'habitaciones', 'antes-despues');
$id = $_POST['id'];
$post = get_post($id);
$gallery = get_post_gallery($post->ID, false);
$category = get_the_category($post->ID);
$cat_elements = array();
$cat_info = array();
foreach ($projectsCats as $cat) {
$catdata = get_category_by_slug($cat);
$args = array('category_name' => $cat, 'orderby' => 'meta_value_num', 'meta_key' => 'order', 'order' => 'ASC', 'posts_per_page' => 3);
$projects = new WP_Query($args);
array_push($cat_info, $catdata);
array_push($cat_elements, $projects);
}
if ($gallery !== false) {
$gallerydata = array();
$images = explode(',', $gallery['ids']);
foreach ($images as $key => $image) {
$imagedata = wp_prepare_attachment_for_js($image);
array_push($gallerydata, $imagedata);
}
$post_info = array('post' => $post, 'category' => $category, 'categories' => $cat_elements, 'cat_info' => $cat_info, 'gallery' => $gallerydata);
echo json_encode($post_info);
}
die;
} else {
echo 'error';
die;
}
die;
}
开发者ID:hugobel,项目名称:wp-shadox,代码行数:34,代码来源:functions.php
示例5: blocks_get_gallery
function blocks_get_gallery($post_id)
{
$ret = array('tags' => array(), 'images' => array());
$gallery = get_post_gallery($post_id, false);
$gallery_ids = $gallery ? explode(',', $gallery['ids']) : array();
foreach ($gallery_ids as $id) {
$thumb = wp_get_attachment_image_src($id, 'medium');
$image = wp_get_attachment_image_src($id, 'large');
if ($thumb && $image) {
$image_data = array('tags' => array(), 'tags_string' => '');
$image_data['thumbnail'] = $thumb;
$image_data['image'] = $image;
$image_data['tags'] = wp_get_post_tags($id);
foreach ($image_data['tags'] as $tag) {
$ret['tags'][$tag->slug] = $tag->name;
$image_data['tags_string'] .= ' ' . $tag->slug;
}
$data = wp_prepare_attachment_for_js($id);
$image_data['title'] = $data['title'];
$image_data['caption'] = $data['caption'];
$image_data['alt'] = $data['alt'];
$image_data['description'] = $data['description'];
$image_data['link'] = get_post_meta($id, "_blocks_link", true);
$ret['images'][] = $image_data;
}
}
asort($ret['tags']);
return $ret;
}
开发者ID:hsnyc,项目名称:gedestad,代码行数:29,代码来源:wp_blocks.php
示例6: get_home_gallery
function get_home_gallery()
{
$galls = get_post_gallery(4, false);
if (!empty($galls['ids'])) {
$ids = explode(',', $galls['ids']);
foreach ($ids as $id) {
//$gall[] = wp_get_attachment_url($id);
echo '<div class="galery-item" style="background: url(\'' . wp_get_attachment_url($id) . '\') center center no-repeat;"></div>';
}
}
}
开发者ID:anucha-digitalnoir,项目名称:freighthub-logistic,代码行数:11,代码来源:functions.php
示例7: kreativa_related_media
function kreativa_related_media($w, $h)
{
?>
<div class="ImageWrapper">
<?php
if (get_post_gallery()) {
$gallery = get_post_gallery(get_the_ID(), false);
?>
<div class="slider">
<div class="fullwidthbanner-container">
<div class="fullwidthbanner">
<ul>
<?php
foreach ($gallery['src'] as $src) {
$img_url = wp_get_attachment_image_src($src);
$n_img = aq_resize($src, $width = $w, $height = $h, $crop = true, $single = true, $upscale = true);
?>
<li class="first-slide" data-transition="fade" data-slotamount="10" data-masterspeed="300">
<img class="img-responsive" src="<?php
echo esc_url($n_img);
?>
" alt="" data-fullwidthcentering="on" alt="slide">
</li>
<?php
}
?>
</ul>
</div>
</div>
</div>
<?php
}
?>
<?php
if (has_post_thumbnail() && !get_post_gallery()) {
$thumbnail = get_post_thumbnail_id();
$img_url = wp_get_attachment_image_src($thumbnail, 'full');
$n_img = aq_resize($img_url[0], $width = $w, $height = $h, $crop = true, $single = true, $upscale = true);
//get img URL
?>
<div class="portfolio-media"> <img src="<?php
echo esc_url($n_img);
?>
" class="img-responsive"/></div>
<?php
}
?>
</div>
<?php
}
开发者ID:rafinkarki,项目名称:My_Themes,代码行数:52,代码来源:helpers.php
示例8: add_anchor_tag
function add_anchor_tag($link)
{
$device = $this->agent_check();
$boxersandswipers_apply = get_option('boxersandswipers_apply');
if (!is_attachment()) {
$is_singular_boxersandswipers_apply = $boxersandswipers_apply[get_post_type(get_the_ID())][$device];
}
$is_home_boxersandswipers_apply = $boxersandswipers_apply['home'][$device];
$is_archive_boxersandswipers_apply = $boxersandswipers_apply['archive'][$device];
$is_category_boxersandswipers_apply = $boxersandswipers_apply['category'][$device];
$is_gallery_boxersandswipers_apply = $boxersandswipers_apply['gallery'][$device];
settype($is_singular_boxersandswipers_apply, "boolean");
settype($is_home_boxersandswipers_apply, "boolean");
settype($is_archive_boxersandswipers_apply, "boolean");
settype($is_category_boxersandswipers_apply, "boolean");
settype($is_gallery_boxersandswipers_apply, "boolean");
$boxersandswipers_exclude = get_post_meta(get_the_ID(), 'boxersandswipers_exclude');
$simplemasonry_apply = get_post_meta(get_the_ID(), 'simplemasonry_apply');
$simplenivoslider_apply = get_post_meta(get_the_ID(), 'simplenivoslider_apply');
if (!empty($boxersandswipers_exclude) && $boxersandswipers_exclude[0]) {
// Through
} else {
if (class_exists('SimpleMasonry') && get_post_gallery(get_the_ID()) && !empty($simplemasonry_apply) && $simplemasonry_apply[0] === 'true') {
// for Simple Masonry Gallery http://wordpress.org/plugins/simple-masonry-gallery/
// for Gallery
if ($is_gallery_boxersandswipers_apply) {
add_filter('post_gallery', array(&$this, 'gallery_filter'));
}
$link = $this->add_anchor_tag_content($link);
} else {
if (class_exists('SimpleNivoSlider') && !empty($simplenivoslider_apply) && $simplenivoslider_apply[0] === 'true') {
// for Simple Nivo Slider http://wordpress.org/plugins/simple-nivoslider/
// Through
} else {
if (!is_attachment()) {
// for Gallery
if ($is_gallery_boxersandswipers_apply) {
add_shortcode('gallery', array(&$this, 'file_gallery_shortcode'));
add_filter('post_gallery', array(&$this, 'gallery_filter'));
}
// for Insert Attachement
if (is_singular() && $is_singular_boxersandswipers_apply || is_home() && $is_home_boxersandswipers_apply || is_archive() && $is_archive_boxersandswipers_apply || is_category() && $is_category_boxersandswipers_apply) {
$link = $this->add_anchor_tag_content($link);
}
}
}
}
}
return $link;
}
开发者ID:alpual,项目名称:sweekswatercolors,代码行数:50,代码来源:BoxersAndSwipers.php
示例9: optimizer_gallery_thumb
function optimizer_gallery_thumb()
{
global $post;
// Make sure the post has a gallery in it
if (has_shortcode($post->post_content, 'gallery')) {
$gallery = get_post_gallery(get_the_ID(), false);
$ids = explode(",", $gallery['ids']);
foreach ($ids as $id) {
$imgurl = wp_get_attachment_image_src($id, array(400, 270));
}
$first_thumb = $imgurl[0];
return $first_thumb;
}
}
开发者ID:danaevernden,项目名称:danaeverndenWP,代码行数:14,代码来源:core.php
示例10: efs_get_slider_postID
function efs_get_slider_postID($postID, $postTitle)
{
$slider = efs_script($postID);
$slider .= '<div class="slidertitle">' . $postTitle . '</div>';
$slider .= '<div id="flexslider-slider' . $postID . '" class="flexslider">
<ul class="slides">';
$carousel = '<div id="flexslider-carousel' . $postID . '" class="flexslider">
<ul class="slides">';
$gallery = get_post_gallery($postID, false);
foreach ($gallery['src'] as $imgsrc) {
$slider .= '<li><img src="' . $imgsrc . '"/></li>';
$carousel .= '<li><img src="' . $imgsrc . '"/></li>';
}
$slider .= '</ul>
</div>';
$carousel .= '</ul>
</div>';
$slider .= $carousel;
return $slider;
}
开发者ID:prabuuce,项目名称:gallery-flexslider,代码行数:20,代码来源:gallery-flexslider.php
示例11: get_post_thumbnail
function get_post_thumbnail($pid, $w, $h = 0)
{
$tid = get_post_thumbnail_id($pid);
$size = 'full';
$src = wp_get_attachment_image_src($tid, $size);
$src = $src[0];
if (!isset($src)) {
$gal = get_post_gallery($pid);
$src = $gal[0]->guid;
}
if (isset($w) && $h == 0) {
$base = basename($src);
$src = '/wp-content/image.php/' . $base . '?image=' . $src . '&width=' . $w;
} else {
if (isset($w) && isset($h)) {
$base = basename($src);
$src = '/wp-content/image.php/' . $base . '?image=' . $src . '&width=' . $w . '&height=' . $h . '&cropratio=' . $w . ':' . $h;
}
}
return $src;
}
开发者ID:jarednova,项目名称:eggs,代码行数:21,代码来源:functions-upstatement.php
示例12: the_ID
?>
</span>
</div>
<?php
}
?>
<article id="post-<?php
the_ID();
?>
" <?php
post_class('postEntry');
?>
>
<?php
$gallery_image_size = array('width' => 750, 'height' => 350);
$gallery = get_post_gallery($post, false);
$ids = explode(",", $gallery['ids']);
//print_r($ids);
if ($gallery) {
?>
<div class="gallerySlider owl-carousel">
<?php
foreach ($ids as $id) {
$image_url = wp_get_attachment_url($id);
echo '<div class="slideItem"><img src="' . bfi_thumb($image_url, $gallery_image_size) . '"></div>';
}
?>
</div>
<?php
}
?>
开发者ID:snrtechnologies,项目名称:magee,代码行数:31,代码来源:content-gallery.php
示例13: the_ID
<article id="post-<?php
the_ID();
?>
" <?php
post_class();
?>
>
<header class="entry-header">
<?php
the_title('<h1 class="entry-title">', '</h1>');
?>
</header>
<?php
if (get_post_gallery()) {
get_template_part('content/content', 'portfolio-gallery');
}
?>
<div class="entry-content">
<?php
$content = get_the_content();
/**
* Get the gallery data from the post.
*/
$gallery_shortcode = argent_get_gallery();
/**
* Grab the first shortcode in post content, strip it out, and
* display the post content without the first gallery.
*/
开发者ID:nitaibezerra,项目名称:Argent-Neue,代码行数:31,代码来源:content-portfolio-single.php
示例14: if
<?
} else if(in_category('remolques')) {
?>
<h1>Remolque con Sanitarios <?php the_title(); ?></h1>
<?
}
?>
<div class="single-header block">
<!--
<div class="portada-header">
<?php the_post_thumbnail('portada'); ?>
</div>
el thumb -->
<!-- comienza gallery -->
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php echo get_post_gallery(); ?>
<?php endwhile; endif; wp_reset_postdata(); ?>
<!-- fin gallery -->
</div>
<!-- columnas -->
<div class="columnas">
<div class="contentleft bg-fff pin">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php
$content = strip_shortcode_gallery( get_the_content() );
$content = str_replace( ']]>', ']]>', apply_filters( 'the_content', $content ) );
echo $content;
?>
<?php endwhile; endif; ?>
</div>
<?php if(in_category('remolques')) {
开发者ID:humbertolopez,项目名称:em_v2,代码行数:31,代码来源:single-product.php
示例15: get_post_gallery
$check_gallery = 0;
$check_audio = 0;
$check_link = 0;
$var_quote = 0;
?>
<!-- Gallery Post Format -->
<?php
if (has_post_format('gallery')) {
$check_gallery = 1;
?>
<div class="owl-img">
<?php
if (get_post_gallery()) {
$gallery = get_post_gallery(get_the_ID(), false);
?>
<?php
foreach ($gallery['src'] as $src) {
$img_url = wp_get_attachment_image_src($src, 'full');
$n_img = aq_resize($src, $width = 750, $height = 316, $crop = true, $single = true, $upscale = true);
?>
<div> <a href="javascript:void(0)"><img class="img-responsive" src="<?php
echo esc_url($n_img);
?>
" alt=""></a> </div>
<?php
}
?>
开发者ID:rafinkarki,项目名称:Themes,代码行数:31,代码来源:article.php
示例16: cherry_get_the_post_gallery
/**
* Get featured gallery.
* If has post thumbnail - will get post thumbnail, else - get first image from content.
*
* @since 4.0.0
* @return string
*/
function cherry_get_the_post_gallery()
{
/**
* Filter post format gallery output to rewrite gallery from child theme or plugins
* @since 4.0.0
*/
$result = apply_filters('cherry_pre_get_post_gallery', false);
if (false !== $result) {
return $result;
}
$post_id = get_the_ID();
// first - try to get images from galleries in post
$shortcode_replaced = cherry_get_option('blog-gallery-shortcode', 'true');
$is_html = 'true' == $shortcode_replaced ? true : false;
$post_gallery = get_post_gallery($post_id, $is_html);
// if stanadrd gallery shortcode replaced with cherry - return HTML
if (is_string($post_gallery) && !empty($post_gallery)) {
return $post_gallery;
}
if (!empty($post_gallery['ids'])) {
$post_gallery = explode(',', $post_gallery['ids']);
} elseif (!empty($post_gallery['src'])) {
$post_gallery = $post_gallery['src'];
} else {
$post_gallery = false;
}
// if can't try to catch images inserted into post
if (!$post_gallery) {
$post_gallery = cherry_get_post_images($post_id, 15);
}
// and if not find any images - try to get images attached to post
if (!$post_gallery || empty($post_gallery)) {
$attachments = get_children(array('post_parent' => $post_id, 'posts_per_page' => 3, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image'));
if ($attachments && is_array($attachments)) {
$post_gallery = array_keys($attachments);
}
}
if (!$post_gallery || empty($post_gallery)) {
return false;
}
$output = cherry_get_gallery_html($post_gallery);
/**
* Filter a post gallery.
*
* @since 4.0.0
*/
$output = apply_filters('cherry_get_the_post_gallery', $output);
return $output;
}
开发者ID:roberto-alarcon,项目名称:Neuroglobal,代码行数:56,代码来源:template-post.php
示例17: widget
public function widget($args, $instance)
{
/** This filter is documented in wp-includes/default-widgets.php */
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
echo '<aside class="widget widget_gallery">';
// echo $args['before_widget'];
if ($title) {
echo $args['before_title'] . $title . $args['after_title'];
}
// Use current theme search form if it exists
?>
<ul>
<?php
if ($gallery = get_post_gallery(get_the_ID(), false)) {
?>
<?php
foreach ($gallery['src'] as $src) {
?>
<li><a title="Images Gallery" href="#"><img src="<?php
echo $src;
?>
" alt="gallery" class="gallery-post" /></a></li>
<?php
}
?>
<?php
}
?>
</ul>
<?php
// echo $args['after_widget'];
echo '</aside>';
}
开发者ID:khiconit,项目名称:makeclean,代码行数:34,代码来源:widgets.php
示例18: get_header
<?php
/*
Template Name: Web
*/
get_header();
?>
<div class="page">
<?php
get_template_part('nav');
?>
<section>
<?php
get_template_part('loader');
?>
<?php
echo get_post_gallery($post->ID);
?>
</section>
</div>
<?php
get_footer();
开发者ID:harrisonfm,项目名称:harrisonfm2,代码行数:22,代码来源:page-web.php
示例19: _lb41f3b28111_content
function _lb41f3b28111_content($_l, $_args)
{
extract($_args);
?>
<?php
if (trim($post->content) != "") {
?>
<style>
</style>
<section class="section content-section">
<div id="container" class="subpage wrapper onecolumn">
<div id="content" class="entry-content clearfix" role="main">
<div class="content-wrapper clearfix">
<header class="entry-title clearfix">
<h1 class="text-align-center"><?php
echo NTemplateHelpers::escapeHtml($post->title, ENT_NOQUOTES);
?>
</h1>
<?php
/* The loop */
while (have_posts()) {
the_post();
if (get_post_gallery()) {
$gallery = get_post_gallery(get_the_ID(), false);
$idsexp = explode(",", $gallery['ids']);
/* Loop through all the image and output them one by one */
foreach ($gallery['src'] as $key => $src) {
$attachment_meta = wp_get_attachment($idsexp[$key]);
$var[$key]['descricao'] = $attachment_meta["alt"];
$var[$key]['src'] = $src;
$var[$key]['grupo'] = $attachment_meta["caption"];
}
$arr = array();
foreach ($var as $v2) {
$arr[] = $v2['grupo'];
}
$arr2 = array_unique($arr);
foreach ($arr2 as $grupo) {
?>
<div class="clientes-1">
<h2 class="clientes-2"><?php
echo $grupo;
?>
</h2>
</div><?php
$contador = 0;
foreach ($var as $key2 => $v) {
if ($v['grupo'] == $grupo) {
$contador++;
if ($contador % 3 == 0) {
$last = 1;
} else {
$last = 0;
}
?>
<div class="clientes-3 <?php
if ($last == 0) {
?>
last-bloco <?php
}
?>
">
<div class="clientes-4">
<img src="<?php
echo $v['src'];
?>
" class="my-custom-class" alt="Gallery image" width="240" height="240" />
</div>
<div class="clientes-5">
<center><b><?php
echo $v['descricao'];
?>
</b></center>
</div>
</div>
<?php
}
}
}
}
}
?>
</header>
</div> <!-- /.content-wrapper -->
</div> <!-- /#content -->
</div> <!-- /#container -->
//.........这里部分代码省略.........
开发者ID:ssuhss,项目名称:Begara,代码行数:101,代码来源:_Templates.page-clientes.php-6b609e3860fd4c9960187d0a93386954.php
示例20: do_action
if ('wide' == $preview_mode) {
$post_classes[] = 'media-wide';
}
?>
<?php
do_action('presscore_before_post');
?>
<article <?php
post_class($post_classes);
?>
>
<div class="blog-media wf-td">
<?php
$gallery = get_post_gallery($post->ID, false);
if (!empty($gallery['ids'])) {
$media_items = array_map('trim', explode(',', $gallery['ids']));
// if we have post thumbnail and it's not hidden
if (has_post_thumbnail() && !get_post_meta($post->ID, '_dt_post_options_hide_thumbnail', true)) {
array_unshift($media_items, get_post_thumbnail_id());
}
$attachments_data = presscore_get_attachment_post_data($media_items);
$preview_style = get_post_meta($post->ID, '_dt_post_options_preview_style_gallery', true);
$style = ' style="width: 100%;"';
$class = array('alignnone');
if (!in_array($layout, array('masonry', 'grid')) && 'normal' == $preview_mode) {
$class = array('alignleft');
$style = ' style="width: 270px;"';
}
switch ($preview_style) {
开发者ID:scottnkerr,项目名称:eeco,代码行数:31,代码来源:content-format-gallery.php
注:本文中的get_post_gallery函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论