Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新谷歌广告为官方样式 #68

Merged
merged 4 commits into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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