当前位置: 首页>>代码示例>>PHP>>正文


PHP get_the_attachment_link函数代码示例

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


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

示例1: attachments

 /**
  * Return list of attachments
  * 
  * <code>
  * [attachments]
  * [attachments type=image]
  * [attachments type=video preview=1]
  * </code>
  */
 function attachments($attributes)
 {
     global $post;
     $mimetypes = array('image', 'video', 'audio', 'application');
     if (isset($attributes['type']) && in_array($attributes['type'], $mimetypes)) {
         $mimetype = $attributes['type'];
     } else {
         $mimetype = null;
     }
     $args = array('post_type' => 'attachment', 'numberposts' => null, 'post_status' => null, 'post_parent' => $post->ID, 'post_mime_type' => $mimetype);
     $attachments = get_children($args);
     if (!is_array($attachments) or !sizeof($attachments)) {
         return '';
     }
     if (isset($attributes['preview'])) {
         $output = '<ul class="attachment-list preview ' . $mimetype . '">';
         foreach ($attachments as $attachment) {
             $output .= '<li>' . get_the_attachment_link($attachment->ID, false) . '</li>';
         }
         $output .= '</ul>';
     } else {
         $output = '<ul class="attachment-list ' . $mimetype . '">';
         foreach ($attachments as $attachment) {
             $output .= '<li><a title="' . $attachment->post_title . '" href="' . wp_get_attachment_url($attachment->ID) . '">' . apply_filters('the_title', $attachment->post_title) . '</a></li>';
         }
         $output .= '</ul>';
     }
     return $output;
 }
开发者ID:rohans,项目名称:tradeinbooks,代码行数:38,代码来源:Shortcodes.php

示例2: while

?>

	<div id="content" class="inside attachment">
				
  <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
	
		<div class="navigation">
			<div class="alignleft">&nbsp;</div>
			<div class="alignright">&nbsp;</div>
		</div>
<?php 
        $attachment_link = get_the_attachment_link($post->ID, true, array(450, 800));
        // This also populates the iconsize for the next line
        $_post =& get_post($post->ID);
        $classname = ($_post->iconsize[0] <= 128 ? 'small' : '') . 'attachment';
        // This lets us style narrow icons specially
        ?>
		<div <?php 
        post_class();
        ?>
 id="post-<?php 
        the_ID();
        ?>
">
			<h2><a href="<?php 
        echo get_permalink($post->post_parent);
        ?>
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:31,代码来源:attachment.php

示例3: get_permalink

        ?>
</h5>

      <h1><a href="<?php 
        echo get_permalink($post->post_parent);
        ?>
" rev="attachment"><?php 
        echo get_the_title($post->post_parent);
        ?>
</a> &raquo; <?php 
        the_title();
        ?>
</h1>

      <div class="pic"><?php 
        echo get_the_attachment_link($post->ID, true, array(690, 690));
        ?>
</div>

    </div>

    <div id="comments">

      <?php 
        comments_template();
        ?>

    </div>

  <?php 
    }
开发者ID:klingerf,项目名称:little-boxes,代码行数:31,代码来源:attachment.php

示例4: prepend_attachment

function prepend_attachment($content) {
	$p = '<p class="attachment">';
	$p .= get_the_attachment_link(false, true, array(400, 300));
	$p .= '</p>';
	$p = apply_filters('prepend_attachment', $p);

	return "$p\n$content";
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:8,代码来源:post-template.php

示例5: bcn_display

if (function_exists('bcn_display')) {
    bcn_display();
}
?>
</strong>
				
				<div id="gallery-box" class="entrytext"> 

				<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>

				<?php 
        $attachment_link = get_the_attachment_link($post->ID, true, array(523, 1000));
        // This also populates the iconsize for the next line
        ?>

				<?php 
        $_post =& get_post($post->ID);
        $classname = ($_post->iconsize[0] <= 50 ? 'small' : '') . 'attachment';
        // This lets us style narrow icons specially
        ?>

					<div class="post" id="post-<?php 
        the_ID();
        ?>
">

						<p class="<?php 
开发者ID:ChristinaCR,项目名称:bhs-15,代码行数:31,代码来源:attachment.php

示例6: wpmu_attachment_loop

function wpmu_attachment_loop()
{
    rewind_posts();
    while (have_posts()) {
        the_post();
        $attachment_link = get_the_attachment_link($post->ID, true, array(450, 800));
        // This also populates the iconsize for the next line
        $_post =& get_post($post->ID);
        $classname = ($_post->iconsize[0] <= 128 ? 'small' : '') . 'attachment';
        // This lets us style narrow icons specially
        ?>

				<div class="post" id="post-<?php 
        the_ID();
        ?>
">

					<h2 class="posttitle"><a href="<?php 
        echo get_permalink($post->post_parent);
        ?>
" rev="attachment"><?php 
        echo get_the_title($post->post_parent);
        ?>
</a> &rarr; <a href="<?php 
        echo get_permalink();
        ?>
" rel="bookmark" title="Permanent Link: <?php 
        the_title();
        ?>
"><?php 
        the_title();
        ?>
</a></h2>

					<div class="entry">
						<p class="<?php 
        echo $classname;
        ?>
"><?php 
        echo $attachment_link;
        ?>
<br /><?php 
        echo basename($post->guid);
        ?>
</p>

						<?php 
        the_content(__('<p class="serif">Read the rest of this entry &rarr;</p>', 'product'));
        ?>

						<?php 
        wp_link_pages(array('before' => __('<p><strong>Pages:</strong> ', 'product'), 'after' => '</p>', 'next_or_number' => 'number'));
        ?>
					</div>

				</div>
			<?php 
        comments_template();
        ?>
				<?php 
    }
}
开发者ID:JeffreyBue,项目名称:jb,代码行数:62,代码来源:loop-functions.php


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