Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if (is_single()): ?>
- <div class="col-left">
- <?php if(is_user_logged_in()):
- //more前の記事 TextAgroup
- $content = get_the_content();
- $content = preg_replace("|(<img[^>]+>)|si","",$content);
- echo $content;
- else:
- //more後の記事 TextBgroup
- global $more;
- $more = 0;
- $content = get_the_content('' , FALSE, '');
- $content = preg_replace("|(<img[^>]+>)|si","",$content);
- echo $content;
- if ($pos=strpos($post->post_content, '<!--more-->')):
- echo '<a href="#">ログイン</a>';
- endif;
- endif; ?>
- </div>
- <div class="col-right">
- <?php if(is_user_logged_in()):
- // ImgAgroupおよびImgBgroup????????
- else:
- // ImgAgroupのみ
- post_linkingthumbs();
- endif; ?>
- </div>
- <?php else: ?>
- <h1 class="page-title"><?php the_title(); ?></h1>
- <?php the_content(); ?>
- <?php endif; ?>
- /**--------------------------------------------
- * the_content内の画像のみ取得 functions.php内
- ---------------------------------------------**/
- function post_linkingthumbs($maxcnt='-1', $imgsize=array()){
- global $post;
- $args = array(
- 'post_type' => 'attachment',
- 'numberposts' => $maxcnt, //取得する画像数(-1の場合は全て)
- 'post_status' => inherit,
- 'post_parent' => $post->ID,
- 'post_mime_type' => 'image',
- 'orderby' => 'menu_order ID',
- );
- $attachments = get_posts($args);
- if (is_array($attachments)) {
- //取得したサムネイル数分出力
- foreach ($attachments as $attachment) {
- 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>';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment