本文整理汇总了PHP中grab_ids_from_gallery函数的典型用法代码示例。如果您正苦于以下问题:PHP grab_ids_from_gallery函数的具体用法?PHP grab_ids_from_gallery怎么用?PHP grab_ids_from_gallery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了grab_ids_from_gallery函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gallery_filter
function gallery_filter($atts, $content = null)
{
extract(shortcode_atts(array('gallery_name' => ''), $args));
$args = array('post_type' => 'attachment', 'posts_per_page' => -1, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order', 'post_mime_type' => 'image');
$output .= "<div id='slider' class='swipe'><div class='swipe-wrap'>";
$attachments = get_posts($args);
$grabids = grab_ids_from_gallery();
if ($attachments) {
foreach ($attachments as $attachment) {
if (in_array($attachment->ID, $grabids)) {
$output .= "<div><img class='slide' src='" . wp_get_attachment_url($attachment->ID) . "' /></div>";
}
}
$output .= " </div><div class='swipe__nav swipe__prev'><i class='icon-left-open-big'></i></div>\n <div class='swipe__nav swipe__next'><i class='icon-right-open-big'></i></div></div>";
}
return $output;
}
示例2: get_post_meta
<?php
$enable_gallery_slider = get_post_meta(get_the_ID(), '_nectar_gallery_slider', true);
?>
<div class="content-inner <?php
if (!empty($enable_gallery_slider) && $enable_gallery_slider == 'on') {
echo 'gallery-slider';
}
?>
">
<?php
$gallery = get_children('post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent=' . $post->post_parent);
$attr = array('class' => "attachment-full wp-post-image");
if (!empty($enable_gallery_slider) && $enable_gallery_slider == 'on') {
$gallery_ids = grab_ids_from_gallery();
?>
<div class="flex-gallery">
<ul class="slides">
<?php
foreach ($gallery_ids as $image_id) {
echo '<li>' . wp_get_attachment_image($image_id, '', false, $attr) . '</li>';
}
?>
</ul>
</div><!--/gallery-->
<?php
}
?>
示例3: grab_ids_from_gallery
</div><!-- .columns -->
</div><!-- .row -->
<div class="gallery-slider-wrapper">
<div class="gallery-slider">
<div class="swiper-container post-id-<?php
echo $post->ID;
?>
format-gallery-swiper">
<div class="swiper-wrapper">
<?php
$galleryImages = grab_ids_from_gallery();
$imagesCount = count(grab_ids_from_gallery());
if ($imagesCount > 0) {
for ($i = 0; $i < $imagesCount; $i++) {
if (!empty($galleryImages[$i])) {
//$imageMarkup = wp_get_attachment_image( $galleryImages[$i], array(1200,900) );
$imageSrc = wp_get_attachment_image_src($galleryImages[$i], array(1200, 900));
?>
<div class="swiper-slide"><img src="<?php
echo $imageSrc[0];
?>
"></div>
<?php
}
}
示例4: nectar_recent_posts
//.........这里部分代码省略.........
<div class="audio-wrap">
<?php
if ($wp_version < "3.6") {
nectar_audio($post->ID);
} else {
$audio_mp3 = get_post_meta($post->ID, '_nectar_audio_mp3', true);
$audio_ogg = get_post_meta($post->ID, '_nectar_audio_ogg', true);
if (!empty($audio_ogg) || !empty($audio_mp3)) {
$audio_output = '[audio ';
if (!empty($audio_mp3)) {
$audio_output .= 'mp3="' . $audio_mp3 . '" ';
}
if (!empty($audio_ogg)) {
$audio_output .= 'ogg="' . $audio_ogg . '"';
}
$audio_output .= ']';
echo do_shortcode($audio_output);
}
}
?>
</div><!--/audio-wrap-->
<?php
} else {
if (get_post_format() == 'gallery') {
if ($wp_version < "3.6") {
if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'second-slide')) {
nectar_gallery($post->ID);
} else {
if (has_post_thumbnail()) {
echo get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => ''));
}
}
} else {
$gallery_ids = grab_ids_from_gallery();
?>
<div class="flex-gallery">
<ul class="slides">
<?php
foreach ($gallery_ids as $image_id) {
echo '<li>' . wp_get_attachment_image($image_id, 'portfolio-thumb', false) . '</li>';
}
?>
</ul>
</div><!--/gallery-->
<?php
}
} else {
if (has_post_thumbnail()) {
echo '<a href="' . get_permalink() . '">' . get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => '')) . '</a>';
}
}
}
}
?>
<div class="post-header">
<h3 class="title"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h3>
<span class="meta-author"><?php
示例5: nectar_recent_posts
//.........这里部分代码省略.........
<div class="audio-wrap">
<?php
if ($wp_version < "3.6") {
nectar_audio($post->ID);
} else {
$audio_mp3 = get_post_meta($post->ID, '_nectar_audio_mp3', true);
$audio_ogg = get_post_meta($post->ID, '_nectar_audio_ogg', true);
if (!empty($audio_ogg) || !empty($audio_mp3)) {
$audio_output = '[audio ';
if (!empty($audio_mp3)) {
$audio_output .= 'mp3="' . $audio_mp3 . '" ';
}
if (!empty($audio_ogg)) {
$audio_output .= 'ogg="' . $audio_ogg . '"';
}
$audio_output .= ']';
echo do_shortcode($audio_output);
}
}
?>
</div><!--/audio-wrap-->
<?php
} else {
if (get_post_format() == 'gallery') {
if ($wp_version < "3.6") {
if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'second-slide')) {
nectar_gallery($post->ID);
} else {
if (has_post_thumbnail()) {
echo get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => ''));
}
}
} else {
$gallery_ids = grab_ids_from_gallery();
?>
<div class="flex-gallery">
<ul class="slides">
<?php
foreach ($gallery_ids as $image_id) {
echo '<li>' . wp_get_attachment_image($image_id, 'portfolio-thumb', false) . '</li>';
}
?>
</ul>
</div><!--/gallery-->
<?php
}
} else {
if (has_post_thumbnail()) {
echo '<a href="' . get_permalink() . '">' . get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => '')) . '</a>';
}
}
}
}
?>
<div class="post-header">
<h3 class="title"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h3>
<span class="meta-author"><?php
示例6: the_title
<header class="entry-header margin-btm sr-only">
<?php
the_title('<h1 class="entry-title">', '</h1>');
?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php
// the_content();
?>
<?php
$attachments = grab_ids_from_gallery();
$i = 0;
if ($attachments) {
foreach ($attachments as $attachment) {
$i++;
$image_thumb = wp_get_attachment_image_src($attachment, 'thumbnail')[0];
$image_lg = wp_get_attachment_image_src($attachment, 'large')[0];
$title = get_the_title($attachment);
//if ( ($i % 7 != 0) == 0) echo '<div class="row">';
//$array = array(1,5,11,16,21,26);
$array = array(1, 7, 13, 19, 25, 31);
if (in_array($i, $array)) {
echo '<div class="row">';
}
?>