/** * 個別ページ用のコンテンツフッターを表示 */ 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; } }
/** * アーカイブページのコンテンツボディ * * @param $is_print bool optional true=>echo false=>return default:false * @param $cb callable optional arg1(string):現在のpostのhtml, arg2(int):何番目のpostか 文字列の返り値があると、postのhtmlを置き換える * @return undefined | string */ function archive_content_body($is_print = false) { global $wp_query; global $post; $post_ = \get_post($post); $currentCard = new LinkCard($post_); $containerClass = $wp_query->current_post === 0 ? 'pure-u-1' : 'pure-u-1 pure-u-xl-1-4 pure-u-lg-1-3 pure-u-md-1-2'; $size = $wp_query->current_post === 0 ? "multi_full" : "multi_item"; $contentHtml = <<<EOD <div class="{$containerClass}"> \t{$currentCard->getCode($size)} </div> EOD; if ($is_print) { echo $contentHtml; } else { return $contentHtml; } }