Guest User

Untitled

a guest
Feb 16th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php if (is_single()): ?>
  2.     <div class="col-left">
  3.     <?php if(is_user_logged_in()):
  4.         //more前の記事 TextAgroup
  5.         $content = get_the_content();
  6.         $content = preg_replace("|(<img[^>]+>)|si","",$content);
  7.         echo $content;
  8.     else:
  9.         //more後の記事 TextBgroup
  10.         global $more;
  11.         $more = 0;
  12.         $content = get_the_content('' , FALSE, '');
  13.         $content = preg_replace("|(<img[^>]+>)|si","",$content);
  14.         echo $content;
  15.         if ($pos=strpos($post->post_content, '<!--more-->')):
  16.             echo '<a href="#">ログイン</a>';
  17.         endif;
  18.     endif; ?>
  19.     </div>
  20.  
  21.     <div class="col-right">
  22.     <?php if(is_user_logged_in()):
  23.      // ImgAgroupおよびImgBgroup????????
  24.     else:
  25.      // ImgAgroupのみ
  26.     post_linkingthumbs();
  27.     endif; ?>
  28.     </div>
  29. <?php else: ?>
  30.     <h1 class="page-title"><?php the_title(); ?></h1>
  31.     <?php the_content(); ?>
  32. <?php endif; ?>
  33.  
  34. /**--------------------------------------------
  35. * the_content内の画像のみ取得 functions.php内
  36. ---------------------------------------------**/
  37. function post_linkingthumbs($maxcnt='-1', $imgsize=array()){
  38.     global $post;
  39.     $args = array(
  40.         'post_type' => 'attachment',
  41.         'numberposts' => $maxcnt,   //取得する画像数(-1の場合は全て)
  42.         'post_status' => inherit,
  43.         'post_parent' => $post->ID,
  44.         'post_mime_type' => 'image',
  45.         'orderby' => 'menu_order ID',
  46.     );
  47.     $attachments = get_posts($args);
  48.     if (is_array($attachments)) {
  49.  
  50.     //取得したサムネイル数分出力
  51.         foreach ($attachments as $attachment) {
  52.         echo '<div class="col-md-4 col-sm-6"><a class="fancybox-button zoomer" href="'.$attachment->guid.'" title="'.$attachment->post_title.'"><span class="overlay-zoom margin-bottom-10">'.wp_get_attachment_image($attachment->ID,'attachment-thumbnail', true, array('class'=>'img-responsive')). '<div class="zoom-icon"></div></span></a></div>';
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment