Пример #1
0
 /**
  * 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
0
?>

	<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);
        ?>
Пример #3
0
        ?>
</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 
    }
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
0
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
0
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 
    }
}