/** * 個別ページ用のコンテンツフッターを表示 */ function singular_content_footer($is_print = false) { $html = ""; //広告 $html .= '<div class="ad-label lined">広告</div>'; $html .= \getAdCode('rectangle'); //次の記事 $next = \get_next_post(true); if ($next) { $next_post = new LinkCard($next); $next_code = $next_post->getCode("article_footer_link", "next-post"); $next_html = <<<EOD <div class="link-card-container"> \t<h5>次の記事</h5> \t\t{$next_code} </div> EOD; } else { $next_html = ""; } //前の記事 $prev = \get_previous_post(true); if ($prev) { $prev_post = new LinkCard($prev); $prev_code = $prev_post->getCode('article_footer_link', 'prev-post'); $prev_html = <<<EOD <div class="link-card-container"> \t<h5>前の記事</h5> \t{$prev_code} </div> EOD; } else { $prev_html = ""; } $nav = $next || $prev ? $next_html . $prev_html : " "; $ad = '<div class="ad-label lined">広告</div>'; $ad .= \getAdCode('scraper'); $html .= <<<EOD <footer class="content pure-g"> \t<div class="pure-u-1 pure-u-sm-3-4 pure-u-md-17-24 pure-u-lg-5-8"> \t\t<div class="content-footer"> \t\t\t{$nav} \t\t</div> \t</div> \t<div class="pure-u-1 pure-u-sm-1-4 pure-u-md-7-24 pure-u-lg-3-8"> \t{$ad} \t</div> </footer> EOD; if ($is_print) { echo $html; } else { return $html; } }
/** * 個別ページのbody */ function singular_content_body($is_print = false) { global $post; $html = ""; $html .= \getAdCode('banner'); if (\has_post_thumbnail()) { $html .= '<div class="post-thumbnail-container">' . \get_the_post_thumbnail() . '</div>'; } $content = \apply_filters('the_content', \get_the_content()); $content = \str_replace(']]>', ']]>', $content); $html .= <<<EOD <div class="content article-body" itemprop="articleBody"> \t{$content} </div> EOD; if ($is_print) { echo $html; } else { return $html; } }
<?php namespace purely; /** * アーカイブページ用コンテンツ表示 * <main>内のドキュメント */ echo archive_content_header(); //echo '<div class="ad-label">広告</div>'; echo \getAdCode('banner'); echo <<<EOD <div class="content"><div class="pure-g"> EOD; while (\have_posts()) { \the_post(); //ループ中、二つ目の記事にはスクレイパー広告を挟む if ($wp_query->current_post === 1) { echo '<div class="pure-u-1 pure-u-xl-1-4 pure-u-lg-1-3 pure-u-md-1-2"><div class="ad-label lined">広告</div><!-- ad scraper -->' . \getAdCode('scraper') . '</div>'; } echo archive_content_body(); } if ($wp_query->post_count > 4) { echo '<div class="pure-u-1 pure-u-xl-1-4 pure-u-lg-1-3 pure-u-md-1-2"><div class="ad-label lined">広告</div><!-- ad rectangle -->' . \getAdCode('rectangle') . '</div>'; } echo <<<EOD </div></div> EOD ;