本文整理汇总了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;
}
示例2: while
?>
<div id="content" class="inside attachment">
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<div class="navigation">
<div class="alignleft"> </div>
<div class="alignright"> </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);
?>
示例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> » <?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
}
示例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";
}
示例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
示例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> → <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 →</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
}
}