Hi, can anybody help me with this?
Hello Sukanya,
The ad code would need to be placed around line 24 just below
get_template_part( 'content', get_post_format() );
As for updates – there will be an update coming soon – I need to work some things out in order to meet the new review guidelines first.
Regards,
Zulf
Hi,
I tried adding the ad code from line 24. But every time I tried doing that, none of my post pages would open. Basically, placing the ad code in the specified location is causing problems with my post pages. They don’t open at all. My homepage however is fine.
If the end of the post position is tricky, is there a way to display the ad in the middle of the post?
Thanks again.
That’s because you are not closing/opening the php tags before and after the ad code – your code should look like the following with the ad code in place of <!-- Place your ad code here -->
?>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Place your ad code here -->
<?php
Let me know how that goes,
Zulf
P.S. If you wish to place to ad in the middle of the post then the best option is to use a plugin as it is more tricky than the above approach.
Thank you for the quick reply. Unfortunately, I am currently using plugins for related posts and also author box. The problem therefore is that to place the ad right at the end of the post content, I need to call the individual functions directly. I am having difficulty about the format in which I should call these functions( I am new at this) Basically, I need to add the following code, after the ad code:
<?php
if ( function_exists( 'get_author_bio_box' ) ) {
echo get_author_bio_box();
}
?>
and
<?php wp_related_posts()?>
If I add these codes as they are, my post pages are not opening. So, if you could just help with the format, as to how I should open and close the php tags, that would be great.
Thanks again for you help.
Thank you for the quick reply. Unfortunately, I am currently using plugins for related posts and also author box. The problem therefore is that to place the ad right at the end of the post content, I need to call the individual functions directly. I am having difficulty about the format in which I should call these functions( I am new at this) Basically, I need to add the following code, after the ad code:
<?php
if ( function_exists( 'get_author_bio_box' ) ) {
echo get_author_bio_box();
}
?>
and
<?php wp_related_posts()?>
If I add these codes as they are, my post pages are not opening. So, if you could just help with the format, as to how I should open and close the php tags, that would be great.
Thanks again for you help.
Anyway I figured it out. Thank you for your help and also for the great theme.
Glad you figured it out and you are most welcome on the theme.
I was in the process of posting a gist for the solution when posted your code – here’s the link for the benefit of others 🙂
https://gist.github.com/zulfnore/201d5cb82fc07809316b
Regards,
Zulf
Sorry to bother you, but is there a way I can shift the ad a bit to the right? I have noticed that in bigger screens, the left border of the ad sometimes gets cut off. Plus the ‘R’ in Related also gets cropped out.I have attached a screenshot.
http://tinypic.com/r/rcsft3/8
Thanks.
You’d probably need to wrap your code in a div class and then control the div with some css – something like
<div class="myad">
<!-- ad code here -->
</div>
CSS:
.myad {
margin-left: 40px;
}
OR:
.myad {
margin: 0 auto;
}
Same would apply for the related posts but here you can target the related posts plugin’s own css.
Ok. I guess I will try doing that. Thanks.