Skip to content

Commit

Permalink
Merge pull request #68 from nuoyis/main
Browse files Browse the repository at this point in the history
更新谷歌广告为官方样式
  • Loading branch information
wehaox committed Jul 1, 2023
2 parents fccc1d8 + 06198a7 commit 6f46c36
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 16 deletions.
37 changes: 35 additions & 2 deletions index.php
Expand Up @@ -44,7 +44,40 @@
<?php $this->need('header.php'); ?>
<main class="layout" id="content-inner">
<div class="recent-posts" id="recent-posts">
<?php while($this->next()): ?>
<?php
if($this->options->googleadsense != ""):
$i=1;
if($this->options->pageSize<=5)
{
$k=$m=$g=3;
}else if($this->options->pageSize==10)
{
$k=rand(3,4);
$m=rand(6,8);
$g=rand(10,12);
}else if($this->options->pageSize>5&&$this->options->pageSize<10){
$k=$m=$g=4;
}
endif;
while($this->next()):
if($this->options->googleadsense != ""):
if($i==$k || $i==$m || $i==$g){
?>
<div class="recent-post-item ads-wrap">
<ins class="adsbygoogle"
style="display:block;height:200px;width:100%;"
data-ad-format="fluid"
data-ad-client="<?php $this->options->googleadsense(); ?>"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<?php
$i++;
}
$i++;
endif;
?>
<div class="recent-post-item">
<wehao class="post_cover">
<a href="<?php $this->permalink() ?>">
Expand Down Expand Up @@ -115,4 +148,4 @@ function ver() {console.log(`
1.7.5
===================================================================
`);}
</script>
</script>
26 changes: 12 additions & 14 deletions post.php
Expand Up @@ -65,20 +65,6 @@
}
echo $content;
?>
<?php if($this->options->googleadsense != ""): ?>
<div class="post-adsense" style="overflow: hidden;">
</br>谷歌推广区(增值备案在网站google.cn内查询)</br>
<ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="<?php $this->options->googleadsense(); ?>"
data-ad-slot="3926138616"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<?php endif; ?>
</article>
<div class="post-copyright">
<div class="post-copyright__author">
Expand Down Expand Up @@ -147,6 +133,18 @@
</ul>
</div>
</div>
<?php endif; ?>
<?php if($this->options->googleadsense != ""): ?>
<div class="ads-wrap">
<ins class="adsbygoogle"
style="display:block;height: 180px;"
data-ad-layout="rectangle,horizonta"
data-ad-format="fluid"
data-ad-client="<?php $this->options->googleadsense(); ?>"></ins></div>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

<?php endif; ?>
<nav class="pagination-post" id="pagination">
<?php $prevId = thePrevCid($this);$nextId=theNextCid($this);?>
Expand Down

0 comments on commit 6f46c36

Please sign in to comment.