Как правильно расположить встроенную рекламу Google в пост-цикле WordPress

у меня есть Сайт-агрегатор на базе WordPress покрытие мобильных ОС и устройств. Сайт довольно прост — у него бесконечная прокрутка на главной странице; каждый пост — недавняя статья с одного из нескольких десятков сайтов, с которых он агрегируется, и с которых мои редакторы будут стремиться выбрать лучшие посты. Заголовок каждого сообщения напрямую связан с оригинальным источником в новом окне.

Я пытаюсь разместить рекламный блок Google AdSense нестандартного размера. в соответствии в потоке сообщений после каждого N сообщения. Это будет отображаться в потоке, как если бы это была любая другая запись.

Я думаю, что у меня это получилось, но объявление просто отображается поверх первого сообщения, а не внутри строки (между сообщениями), где оно должно быть.

Я не уверен, является ли это проблемой CSS или проблемой PHP. Кто-нибудь может помочь подтолкнуть меня в правильном направлении?

Текущий код PHP для цикла post находится здесь:

<?php

get_header();

//VAR SETUP
$homeCategory = get_option('themolitor_home_category');
$homeNumber = get_theme_mod('themolitor_customizer_home_number');
$showtitle = get_theme_mod('themolitor_customizer_post_title_onoff');
$showsample = get_theme_mod('themolitor_customizer_excerpt_onoff');
$previewLink = get_theme_mod('themolitor_customizer_preview');

$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('cat='. $homeCategory .'&showposts='. $homeNumber .'&paged='. $paged .'');
$postCount == 1;

if($wp_query->have_posts()): ?>

<div id="listing">

<?php
while ($wp_query->have_posts()) : $postCount = $postCount + 1; $wp_query->the_post();

if($postCount == 10 ) { echo '<div name=id="InlineGAd"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Front Page - Inline Ads -->
<ins class="adsbygoogle"style="display:inline-block;width:280px;height:250px"data-ad-client="ca-pub-8809439536811486"data-ad-slot="9759022301"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div><div style="clear:both;"></div>'; }

$data = get_post_meta( $post->ID, 'key', true );
if(!empty($data[ 'video' ])){$video = $data[ 'video' ];}
?>

<div <?php post_class(); ?>>

<?php if (has_post_thumbnail()) { ?>
<a class="thumbLink" href="<?php if($previewLink == "image") { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo $large_image_url[0]; } else { the_permalink(); } ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail('grid'); ?>
</a>
<?php } elseif ($video) { echo $video; } ?>

<?php if($showtitle){ ?>
<h2 class="postLink"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link to','themolitor');?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php } ?>

<?php if($showsample){?>
<?php the_excerpt();?>
<a class="readMore" href="<?php the_permalink() ?>"><?php _e('Read More','themolitor');?> &rarr;</a>
<?php } ?>

</div><!--end post-->
<?php endwhile;?>

</div><!--end listing-->

<?php
get_template_part('navigation');
endif;
$wp_query = null; $wp_query = $temp;
get_footer();
?>

И текущий код CSS здесь:

#InlineGAd { margin: 0 30px 30px 0; clear: both;}
.aligncenter,
.bypostauthor,
.sticky,
.wp-caption-text,
.gallery-caption,
.wp-caption {}

.alert {color: red;}

* {padding: 0; margin: 0; line-height: 1.7em;}

/* -----BODY STUFF----- */
body {height:auto; width:auto; color:#666;}

/* -----A TAG STUFF----- */
a {text-decoration:none;}
a:hover {text-decoration:none; color: #000;}

p {font-size: 11px; margin-bottom: 10px;}

/* -----H TAG STUFF----- */
h1,h2,h3, h4, h5, h6 {color: #333; font-weight: normal;}
h1,h1 a,h1 a:visited,
h2,h2 a,h2 a:visited,
h3,h3 a,h3 a:visited,
h4,h4 a,h4 a:visited,
h5,h5 a,h5 a:visited,
h6,h6 a,h6 a:visited {text-decoration:none;}
h1 a:hover,
h2 a:hover,
h3 a:hover,
h4 a:hover,
h5 a:hover,
h6 a:hover {text-decoration:none;}

/* -----PAGE STUFF----- */
#contentContainer {width:100%;}
#content {padding: 30px 30px 60px;}

#leftContent {width: 280px; margin-right: 30px; float: left; }
#rightContent {width: 590px; float: left;}
#fullWidth {padding-left: 310px;}
#fullWidth #leftContent {margin-left: -310px;}/*---------HEADER STUFF-----------*/
#headerContainer {width:100%; border-bottom: 1px solid #f2f2f2; }
#header {position: relative; padding: 30px; background: url(images/backgrounds/stripe_right_bg.png) repeat; border-bottom: 1px solid #fff;}

a#logo  {width: 280px; display: block; float: left; margin: 5px 0;}

/*--------FOOTER STUFF--------*/
#footerContainer {width:100%; position: fixed; left: 0px; bottom: 0px; z-index: 1001;}
body.mobileBrowser #footerContainer {position: static;}
#footer {height: 30px;}
#footer #copyright {font-size: 9px; text-transform: uppercase; line-height: 30px; margin-left: 30px; padding: 0 10px; color: #fff;}
#footer #copyright a {color: #fff; border-bottom: 1px dotted #fff;}
#footer #copyright a:hover {border-bottom-style: solid;}

#backTop {display:none; width: 30px; height: 30px; position: fixed; bottom: 0; left: 0; line-height: 30; z-index: 1004; background: url(images/backtop.png) no-repeat center center; cursor: pointer;}

.socialicon {width: 18px; height: 18px; float: right; background-image: url(images/social.png); margin: 6px 0 0 10px; border: none !important;}
.socialicon:hover {border: none !important;}
#youtubeIcon {background-position: 0px 0px;}
#vimeoIcon {background-position: -18px 0px; }
#twitterIcon {background-position: -36px 0px; }
#skypeIcon {background-position: -54px 0px; }
#rssIcon {background-position: -72px 0px; }
#myspaceIcon {background-position: -90px 0px; }
#facebookIcon {background-position: -108px 0px; }
#flickrIcon {background-position: -126px 0px; }
#linkedinIcon {background-position: -144px 0px; }

#youtubeIcon:hover {background-position: 0px -18px;}
#vimeoIcon:hover {background-position: -18px -18px; }
#twitterIcon:hover {background-position: -36px -18px; }
#skypeIcon:hover {background-position: -54px -18px; }
#rssIcon:hover {background-position: -72px -18px; }
#myspaceIcon:hover {background-position: -90px -18px; }
#facebookIcon:hover {background-position: -108px -18px; }
#flickrIcon:hover {background-position: -126px -18px; }
#linkedinIcon:hover {background-position: -144px -18px; }/*-------MAIN NAVIGATION STUFF--------*/
#navigation {width: 620px; float: left;}
#dropmenu {list-style:none; position:relative; width:100%; z-index: 400;}
#dropmenu li {list-style:none;   position:relative; float: left; line-height: 20px; width: 126px; margin-left: 30px;}
#dropmenu li a { display: block; line-height: 20px; font-size: 10px; text-transform: uppercase; /*color: #666;*/}
#dropmenu li a:hover {text-decoration: none; color: #000;}
#dropmenu li ul {list-style:none; display:none; position:absolute; width:180px; z-index:300; top:20px; left: 0; background: #fff; padding: 5px 0;}
#dropmenu li ul li {position:relative; margin: 0;}
#dropmenu li ul li a {line-height: 30px; padding: 0 15px;}
#dropmenu li ul li ul {}
#dropmenu li:hover ul ul,
#dropmenu li:hover ul ul ul,
#dropmenu li:hover ul ul ul ul {display:none;}
#dropmenu li:hover ul,
#dropmenu li li:hover ul,
#dropmenu li li li:hover ul,
#dropmenu li li li li:hover ul {display:block;}
#dropmenu li.current-menu-item > a,
#dropmenu li.current-menu-ancestor > a {color: #000;}

/* -----SEARCH STUFF----- */
#searchform {background: none; border: 1px solid #bbb; width: 260px; height: 35px;}
#searchform #s {width:190px; padding:0 10px; height: 35px; line-height: 35px; margin: 0; background: none; border: none;}
#searchform #searchsubmit {cursor: pointer; padding:10px 0 10px 10px; float: left;}
#searchform #searchsubmit:hover {text-decoration: none;}

/* -----POST AND ENTRY STUFF----- */
.column {width: 280px; float: left; margin-left: 30px;}
.firstColumn {margin-left: 0;}
.noImgColumn {width: 590px; float: left; margin-left: 30px;}

#crumbs {font-size: 10px; text-transform: uppercase; margin-bottom: 30px; font-style: italic;}

#listing .post { margin: 0 30px 30px 0; text-align: justify; float: left;}

.post {width: 280px;}

.listing .firstColumn {min-height: 170px; border-bottom: 1px solid #ececec; }
.listing .post,
.listing .page {margin: 0 30px 30px 0; text-align: justify; width: 900px;}
.listing h2.posttitle {margin-bottom: 15px;}
.listing .metaStuff {padding-bottom: 0; margin-bottom: 0; border-bottom:none; }
.listing .post a.thumbLink img {margin:0;}

h2.posttitle,
.entrytitle {font-size: 14px; margin-bottom: 25px; color: #555;}
.entry{font-size: 12px;}
.entry ol,.entry ul {margin:0 0 15px 25px; padding: 0; font-size: 12px;}
.entry li {padding:0 0 0 5px; list-style-position:outside; line-height: 1.5em;}
.entry p {margin: 0 0 15px;}
.details {font-size: 12px;  margin-bottom: 35px;}

.entry h1, .entry h2, .entry h3, .entry h4,.entry h5,.entry h6 {}

.entry {text-align: justify}

.postLink {font-size: 14px; margin-bottom: 5px;}

#loaderGif,
#infscr-loading {position: fixed; width: 32px; height: 32px; line-height: 32px; background:#fff; padding:3px; overflow: hidden; right:30px; text-align: center; bottom: 60px; z-index: 2000; font-size: 10px; }
#infscr-loading div {visibility: hidden;}

body.mobileBrowser #loaderGif,
body.mobileBrowser #infscr-loading {position: static;}

body.single .post {float: left;}

#postImgs {margin-left: 310px;}
#postImgs .postImg {margin: 0 30px 30px 0; width: 280px; float: left;}
#postImgs .postImg img {width: 280px;}

body.mobileBrowser #postImgs .postImg,
body.mobileBrowser #listing .post {margin: 0 25px 25px 0;}

.entrytitle {padding-bottom: 15px; border-bottom: 1px solid #ececec; }
.metaStuff {padding-bottom: 25px; margin-bottom: 30px; border-bottom: 1px solid #ececec; }

.metaItem {font-size: 10px; font-style: italic; color: #888; margin-bottom: 5px; padding-left: 17px;}
.dateStuff {background: url(images/clock.gif) no-repeat left 2px;}
.categoryStuff {background: url(images/folder.gif) no-repeat left 1px;}
.authorStuff {background: url(images/person.gif) no-repeat left 2px;}
.commentStuff {background: url(images/comment_left.gif) no-repeat left 2px;}
.tagStuff {background: url(images/tag.gif) no-repeat left 2px;}

#videoEmbed {width: 590px; float: left;}
#videoEmbed iframe {width: 590px; height: 400px; margin: 0 0 30px 30px;}
iframe {border: none;}

.readMore {font-size: 11px;}

/*--- POST THUMBNAIL STUFF ---*/
div.post a.thumbLink {display: block; padding: 0;}
div.post a.thumbLink img {display: block; margin:0 0 10px 0; }

/*-------BLOG PAGE NAVIGATION STUFF----------*/
.navigation {float:left; font-size:12px; width: 100%;}
.navigation .pagenav a {display: block;}
.navigation .pagenav a:hover {text-decoration: underline;}

/*-----SIDEBAR STUFF----*/
#sidebarToggle {width: 160px; height: 160px; overflow: hidden; position: fixed; top: 0; right: 0; z-index: 1001; }
#plusSign {position: absolute; width: 31px; height: 30px; right: 30px; top: 30px; z-index: 1000; background: url(images/plus.png) no-repeat left top; cursor: pointer;}
#plusSign.closeMe {background-position: bottom left}
#sidebarAccent {
width: 320px;
height: 320px;
position: absolute;
left: 70px;
top: -160px;
cursor: pointer;
z-index: 999;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform:rotate(45deg);
-ms-transform:rotate(45deg);
transform: rotate(45deg);
}

#sidebar {display:none; position: fixed; width: 350px;top: 0; right: 0; background: #fff; background: rgba(255,255,255,.95); z-index: 1000; text-align: justify; overflow: auto;
-webkit-box-shadow: 0px 0px 30px rgba(0,0,0,.4);
-moz-box-shadow: 0px 0px 30px rgba(0,0,0,.4);
box-shadow: 0px 0px 30px rgba(0,0,0,.4);
}
#sidebar ul li.widget {list-style: none; margin: 0; font-size: 11px; padding: 0 0 40px 40px; width: 260px;}
#sidebar ul li.widget:first-child {padding-top: 40px;}
#sidebar ul li.widget h2.widgettitle {font-size: 14px; margin-bottom: 10px;}
#sidebar ul li.widget ul li {list-style-type:disc; list-style-position: outside; margin-left: 15px; margin-bottom: 10px;}
#sidebar ul li.widget ul li ul li {padding: 0 0 0 15px; list-style-type:disc; list-style-position: inside;}

/* -----COMMENT STUFF----- */
#commentToggle {background: #ececec; padding: 5px 10px; color: #4c4c4c; font-size: 10px; text-transform: uppercase; margin: 0 0 15px; line-height: 1em; cursor: pointer;}
#commentToggle:hover {background: #ddd;}
#commentToggle a {color: #4c4c4c;}
#commentToggle a:hover {text-decoration: none;}
#toggleComments {display: none;}
#commentOpen {float: right;}
#commentClose {display: none; float: right;}

#commentsection {width:100%;   font-size: 12px;}
.commentlist {width: 100%; list-style:none; }
h3.comments {margin:40px auto 20px;}
.commentlist li,#commentform input,#commentform textarea {font:.9em 'Lucida Grande', Verdana, Arial, Sans-Serif;}
.commentlist li {font-weight:bold;list-style:none; padding:15px 0; font-size:12px;}
.commentlist li img.avatar {float:left;margin-right:10px;padding:3px;}
.commentlist cite,.commentlist cite a {font-weight:bold;font-style:normal;}
.commentlist p {font-weight:normal; text-transform:none;margin:10px 0px 10px 47px;}
.commentlist .pingback p {margin:10px 5px 10px;}
#commentform p {margin:5px 0;}
.commentmetadata {font-weight:normal;display:block; font-size:10px; color:#333; padding:3px 0 0; text-transform:uppercase;}
cite.fn {text-transform:uppercase;}
.commentlist {text-align:justify;padding:0 0 40px;}
.nocomments {text-align:center;}
#recentcomments li {}
.alt {}

.children {margin-left: 42px;}

.reply {text-align: right; font-size: 11px;}

/*---FORM STUFF---*/
input[type="text"],input[type="password"] {padding: 5px; width:200px; margin:5px 0 0 0;}
textarea {padding: 4px; width:90%;font-size: 12px;}

#commentsection input[type="text"],input[type="password"] {width:50%;}
#commentsection textarea {width:270px;}

input[type="text"],
input[type="password"],
textarea {border: 1px solid #ccc; margin-top: 5px;}

#commentform input[type="submit"],
input[type="submit"] {cursor: pointer; color:#fff; border: none; display: block; padding: 4px 10px;}
#commentform input[type="submit"]:hover,
input[type="submit"]:hover {background: #333;}

#sidebar input, #sidebar textarea {padding:3px}
#sidebar input[type="submit"]{cursor:pointer;}

/* -----UNIVERSAL STUFF----- */
code {font:1.1em 'Courier New', Courier, Fixed;}
acronym,abbr,span.caps {font-size:.9em;letter-spacing:.07em;cursor:help;}
p img {max-width:100%;}
img.centered {display:block;margin:0 auto;}
img.alignright {display:inline;margin:0 0 10px 10px;}
img.alignleft {display:inline;margin:0 10px 10px 0;}
.alignright {float:right;}
.alignleft {float:left;}
acronym.abbr {border-bottom:1px dashed #999;}
blockquote {padding-left:20px;margin:10px; border-left: 5px solid #eee;}
blockquote cite {display:block;margin:5px 0 0;}
.center {text-align:center;}
hr {display:none;}
a img {border:none;}
img#wpstats {width:0;height:0;border:none;overflow:hidden;}
#hideme {visibility:hidden;}
.hidden {visibility: hidden; display: none;}
.rssSummary {padding-bottom:15px;}
.clear {clear: both;}
p.clear {height:1px; width:1px; }
.hide {display: none;}
.gallery-item img {border: none !important;}

/* -----CALENDAR STUFF----- */
#wp-calendar {empty-cells:show;width:100%;margin:10px auto 0;}
#wp-calendar #prev a,#wp-calendar #next a {font-size:9pt;}
#wp-calendar #next a {padding-right:10px;text-align:right;}
#wp-calendar #prev a {padding-left:10px;text-align:left;}
#wp-calendar a {text-decoration:none;display:block;}
#wp-calendar caption {font:bold 1.3em 'Lucida Grande', Verdana, Arial, Sans-Serif;text-align:center;width:100%;}
#wp-calendar th {font-style:normal;text-transform:capitalize;}
#wp-calendar td {text-align:center;padding:3px 0;}
#wp-calendar td.pad:hover {background-color:#fff;}

/*----TAG CLOUD WIDGET STUFF-------*/
.widget_tag_cloud a {
font-size: 10px !important;
display: block;
float: left;
padding: 2px 8px;
color: #fff;
margin: 0 3px 3px 0;
}
.widget_tag_cloud a:hover {background: #555}
.widget_tag_cloud:after {
content: ".";
display: block;
height: 0;
clear: left;
visibility: hidden;
*zoom:1
}

0

Решение

Вы можете получить помощь с плагином WordPress:
Adsense Между WordPress Post

0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector