need help with adsense for wordpress

3 replies
  • WEB DESIGN
  • |
hi...
i wanted to have a static home page and a separate blog page for updating my site...

i did the following
-created a new home page
-created a page named blog
-created a custom menu and added all the pages which i need.. i did not add the default wordpress home page
-in settings reading option for front page displays i selected my custom home page for front page and blog page as post page
- i want to display adsense on my static front page but on adding the adsense code to the text widget the ads are being displayed on the blog page which i selected as my post page and they are not displayed on the static home page..

what changes shud i make in order for my ads to display on static home page and not on the post page

i tried this code

<?php if (is_home()) { ?>
YOUR AD CODE
<?php } ?>

but it doesnt work...

Regards
Aniket
#adsense #wordpress
  • Profile picture of the author amilajoy
    You can use widget logic to restrict a widget to a page, homepage etc. Alternately you can use advanced text widget to do this job.
    Signature

    Recover Wordpress Hacked Blogs

    {{ DiscussionBoard.errors[5300251].message }}
  • Profile picture of the author xtrapunch
    When you set a static page as the homepage, it is treated as the "front page". So, the is_home() condition is negative here. Use this code:

    <?php if ( is_home() || is_front_page() ) { ?>
    <?php // The code will be executed on homepage - both static as well as index ?>
    <? php endif; ?>
    Signature
    >> Web Design, Wordpress & SEO - XtraPunch.com <<
    Web Design & SEO Agency | Serving World Wide from New Delhi, India

    {{ DiscussionBoard.errors[5304529].message }}
    • Profile picture of the author aniketsrivastava
      Originally Posted by xtrapunch View Post

      When you set a static page as the homepage, it is treated as the "front page". So, the is_home() condition is negative here. Use this code:

      <?php if ( is_home() || is_front_page() ) { ?>
      <?php // The code will be executed on homepage - both static as well as index ?>
      <? php endif; ?>
      thanks for d reply ..where shud i put my adsense code in the code which u have given
      {{ DiscussionBoard.errors[5304678].message }}

Trending Topics