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

PHP get_post_gallery_ids函数代码示例

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

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



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

示例1: fg_display_metabox

function fg_display_metabox()
{
    global $post;
    // Get the Information data if its already been entered
    $galleryHTML = '';
    $selectText = 'Select Images';
    $visible = '';
    //SHOULD WE SHOW THE REMOVE ALL BUTTON? THIS WILL BE APPLIED AS A CLASS, AND IS BLANK BY DEFAULT.
    $galleryArray = get_post_gallery_ids($post->ID);
    $galleryString = get_post_gallery_ids($post->ID, 'string');
    if (!empty($galleryString)) {
        foreach ($galleryArray as &$id) {
            $galleryHTML .= '<li><button>&#xf335</button><img id="' . $id . '" src="' . wp_get_attachment_url($id) . '"></li> ';
        }
        $selectText = 'Edit Selection';
        $visible = " visible";
    }
    update_post_meta($post->ID, 'fg_temp_metadata', $galleryString);
    // Overwrite the temporary featured gallery data with the permanent data. This is a precaution in case someone clicks Preview Changes, then exits withing saving.
    ?>

	<input type="hidden" name="fg_temp_noncedata" id="fg_temp_noncedata" value="<?php 
    echo wp_create_nonce("fg_temp_noncevalue");
    ?>
" />

	<input type="hidden" name="fg_perm_noncedata" id="fg_perm_noncedata" value="<?php 
    echo wp_create_nonce(plugin_basename(__FILE__));
    ?>
" />

	<input type="hidden" name="fg_perm_metadata" id="fg_perm_metadata" value="<?php 
    echo $galleryString;
    ?>
" data-post_id="<?php 
    echo $post->ID;
    ?>
" />

	<button class="button" id="fg_select"><?php 
    echo $selectText;
    ?>
</button>

	<button class="button<?php 
    echo $visible;
    ?>
" id="fg_removeall">Remove All</button>

	<ul><?php 
    echo $galleryHTML;
    ?>
</ul><div style="clear:both;"></div><?php 
}
开发者ID:javalidigital,项目名称:multipla,代码行数:54,代码来源:metabox.php


示例2: fg_display_metabox

function fg_display_metabox()
{
    global $post;
    // Get the Information data if its already been entered
    $galleryHTML = '';
    $oldfix = '';
    if (get_bloginfo('version') >= 3.8) {
        $button = '<button>&#xf335;</button>';
    } else {
        $button = '<button class="media-modal-icon"></button>';
        $oldfix = ' premp6';
    }
    $selectText = __('Select Images', 'cumulo');
    $visible = '';
    //SHOULD WE SHOW THE REMOVE ALL BUTTON? THIS WILL BE APPLIED AS A CLASS, AND IS BLANK BY DEFAULT.
    $galleryArray = get_post_gallery_ids($post->ID);
    $galleryString = get_post_gallery_ids($post->ID, 'string');
    if (!empty($galleryString)) {
        foreach ($galleryArray as &$id) {
            $galleryHTML .= '<li>' . $button . '<img id="' . $id . '" src="' . cmo_get_val_from_array(wp_get_attachment_image_src($id)) . '"></li> ';
        }
        $selectText = __('Edit Selection', 'cumulo');
        $visible = " visible";
    }
    update_post_meta($post->ID, 'fg_temp_metadata', $galleryString);
    // Overwrite the temporary featured gallery data with the permanent data. This is a precaution in case someone clicks Preview Changes, then exits withing saving.
    ?>

	<input type="hidden" name="fg_temp_noncedata" id="fg_temp_noncedata" value="<?php 
    echo wp_create_nonce('fg_temp_noncevalue');
    ?>
" />

	<input type="hidden" name="fg_perm_noncedata" id="fg_perm_noncedata" value="<?php 
    echo wp_create_nonce(plugin_basename(__FILE__));
    ?>
" />

	<input type="hidden" name="fg_perm_metadata" id="fg_perm_metadata" value="<?php 
    echo esc_attr($galleryString);
    ?>
" data-post_id="<?php 
    echo esc_attr($post->ID);
    ?>
" />

	<button class="button" id="fg_select"><?php 
    echo esc_html($selectText);
    ?>
</button>

	<button class="button<?php 
    echo esc_attr($visible) . esc_attr($oldfix);
    ?>
" id="fg_removeall"><?php 
    _e('Remove All', 'cumulo');
    ?>
</button>

	<ul><?php 
    echo $galleryHTML;
    ?>
</ul>

	<div style="clear:both;"></div><?php 
}
开发者ID:supahseppe,项目名称:ashley-travel,代码行数:66,代码来源:metabox.php


示例3: wp_enqueue_script

<?php

//enqueu script for responsiveslides_js
wp_enqueue_script('responsiveslides_js');
wp_enqueue_style('responsiveslides_css');
$galleryArray = get_post_gallery_ids($post->ID);
if ($galleryArray) {
    echo '<div class="featured_image video_post">
					<ul class="rslides">';
    foreach ($galleryArray as $id) {
        $image_resize = aq_resize(wp_get_attachment_url($id), 770, 430, true, true, true);
        $image_resize = $image_resize ? $image_resize : wp_get_attachment_url($id);
        ?>
						
						<li><img src="<?php 
        echo $image_resize;
        ?>
" alt=""></li>
	<?php 
    }
    echo '	</ul>
			  </div>';
    ?>
		<script type="text/javascript">
          jQuery(document).ready(function($){
              "use script";
                /* ResponsiveSlider Internal Posts Gallery slider */
                // Slideshow 2
                $(".rslides").responsiveSlides({
				auto: true,
				pager: true,
开发者ID:javalidigital,项目名称:multipla,代码行数:31,代码来源:single-post-gallery.php


示例4: blog_sc


//.........这里部分代码省略.........
                    echo '"><div class="post_quote_text" >';
                    echo !empty($quote_text) ? $quote_text : '';
                    echo '<span class="post_quote_icon fa-link"></span></div>';
                    echo '<div class="post_quote_author" >';
                    echo !empty($quote_author) ? $quote_author : '';
                    echo '</div>';
                    echo '</a></div>';
                } else {
                    if (get_post_meta($post->ID, 'rd_show_slider', true) == 'yes') {
                        if ($post_format == '' && '' != get_the_post_thumbnail() || $post_format == 'image' && '' != get_the_post_thumbnail()) {
                            $url = wp_get_attachment_url(get_post_thumbnail_id($post->ID), 'full');
                            echo "<div class='post-attachement'>";
                            echo '<a href="' . get_permalink($post->ID) . '" class="blog_img_overlay">';
                            if ($tn_size !== '') {
                                echo the_post_thumbnail('full');
                            } else {
                                echo the_post_thumbnail('blog_tn');
                            }
                            echo "</a><a href='" . $url . "' class='prettyPhoto post-att-zoom'><i class='fa fa-expand'></i></a></div><div class='sep_25'></div>";
                        } elseif ($post_format == 'audio') {
                            preg_match("!\\[audio.+?\\]\\[\\/audio\\]!", $content, $match_audio);
                            if (!empty($match_audio)) {
                                echo '<div class="audio_ctn" >';
                                echo do_shortcode($match_audio[0]);
                                echo '</div>';
                                $content = str_replace($match_audio[0], "", $content);
                                $content = apply_filters('the_content', $content);
                                $content = str_replace(']]>', ']]&gt;', $content);
                                echo "<div class='sep_25'></div>";
                            }
                        } elseif ($post_format == 'video' && $my_video !== '') {
                            echo "<div class='post-attachement'>" . $my_video . "</div><div class='sep_25'></div>";
                        } elseif ($post_format == 'gallery') {
                            $galleryArray = get_post_gallery_ids($post->ID);
                            if ($galleryArray) {
                                echo "<div class='post-attachement'><div class='flexslider'><ul class='slides'>";
                                foreach ($galleryArray as $id) {
                                    $url = wp_get_attachment_url($id, 'full', 0);
                                    echo "<li>";
                                    echo '<a href="' . get_permalink($post->ID) . '" class="blog_img_overlay">';
                                    if ($tn_size !== '') {
                                        echo wp_get_attachment_image($id, 'full', 0);
                                    } else {
                                        echo wp_get_attachment_image($id, 'blog_tn', 0);
                                    }
                                    echo "</a><a href='" . $url . "' class='prettyPhoto post-att-zoom'><i class='fa fa-expand'></i></a></li>";
                                }
                                echo "</ul></div></div><div class='sep_25'></div>";
                            }
                        }
                    }
                    ?>
  <div class="post_ctn"> 
    <!-- .title -->
    <div class="post-title">
      <h2><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
        <?php 
                    the_title();
                    ?>
        </a></h2>
开发者ID:axelander95,项目名称:wsguiavirtualpichincha,代码行数:67,代码来源:rd_blog.php


示例5: the_ID

<article id="post-<?php 
the_ID();
?>
" <?php 
post_class("cmo-post-in-list");
?>
>
	<div class="cmo-article-featured-wrapper">
	<?php 
$ids = get_post_gallery_ids(get_the_ID());
$ids = array_filter($ids);
if ($ids && count($ids) > 0) {
    echo '<div class="owl-gallery-carousel">';
    foreach ($ids as $gid) {
        echo wp_get_attachment_image($gid, "full");
    }
    echo '</div>';
}
?>
	</div>
	<div class="cmo-article-contents">
		<div class="cmo-article-meta-wrapper">
			<a class="cmo-article-meta-date" href="<?php 
echo get_permalink(get_the_ID());
?>
">
				<time datetime="<?php 
the_time("c");
?>
">
					<span class="time-day"><?php 
开发者ID:supahseppe,项目名称:ashley-travel,代码行数:31,代码来源:content-gallery.php


示例6: get_blog_posts


//.........这里部分代码省略.........
                    echo '"><div class="post_quote_text" >';
                    echo !empty($quote_text) ? $quote_text : '';
                    echo '<span class="post_quote_icon fa-link"></span></div>';
                    echo '<div class="post_quote_author" >';
                    echo !empty($quote_author) ? $quote_author : '';
                    echo '</div>';
                    echo '</a>';
                } else {
                    if (get_post_meta($post->ID, 'rd_show_slider', true) == 'yes') {
                        if ($post_format == '' && '' != get_the_post_thumbnail() || $post_format == 'image' && '' != get_the_post_thumbnail()) {
                            $url = wp_get_attachment_url(get_post_thumbnail_id($post->ID), 'full');
                            echo "<div class='post-attachement'>";
                            echo '<a href="' . get_permalink($post->ID) . '" class="blog_img_overlay">';
                            if ($tn_size == 'full') {
                                echo the_post_thumbnail('full');
                            } else {
                                echo the_post_thumbnail('blog_tn');
                            }
                            echo "</a><a href='" . $url . "' class='prettyPhoto post-att-zoom'><i class='fa fa-expand'></i></a></div><div class='sep_25'></div>";
                        } elseif ($post_format == 'audio') {
                            preg_match("!\\[audio.+?\\]\\[\\/audio\\]!", $content, $match_audio);
                            if (!empty($match_audio)) {
                                echo '<div class="audio_ctn" >';
                                echo do_shortcode($match_audio[0]);
                                echo '</div>';
                                $content = str_replace($match_audio[0], "", $content);
                                $content = apply_filters('the_content', $content);
                                $content = str_replace(']]>', ']]&gt;', $content);
                                echo "<div class='sep_25'></div>";
                            }
                        } elseif ($post_format == 'video' && $my_video !== '') {
                            echo "<div class='post-attachement'>" . $my_video . "</div><div class='sep_25'></div>";
                        } elseif ($post_format == 'gallery') {
                            $galleryArray = get_post_gallery_ids($post->ID);
                            if ($galleryArray) {
                                echo "<div class='post-attachement'><div class='flexslider'><ul class='slides'>";
                                foreach ($galleryArray as $id) {
                                    $url = wp_get_attachment_url($id, 'full', 0);
                                    echo "<li>";
                                    echo '<a href="' . get_permalink($post->ID) . '" class="blog_img_overlay">';
                                    if ($tn_size == 'full') {
                                        echo wp_get_attachment_image($id, 'full', 0);
                                    } else {
                                        echo wp_get_attachment_image($id, 'blog_tn', 0);
                                    }
                                    echo "</a><a href='" . $url . "' class='prettyPhoto post-att-zoom'><i class='fa fa-expand'></i></a></li>";
                                }
                                echo "</ul></div></div><div class='sep_25'></div>";
                            }
                        }
                    }
                    ?>
  <div class="post_ctn"> 
    <!-- .title -->
    <div class="post-title">
      <h2><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
        <?php 
                    the_title();
                    ?>
        </a></h2>
开发者ID:vorcil,项目名称:adaptiveres,代码行数:67,代码来源:ajax-handlers.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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