Showing ads after posts in home page

I don’t believe the code worked what you have posted. If you simply copied and pasted it from your template, it would never have worked.

There are a couple of syntax errors/bugs in your code

  1. <?php if((have_posts)): ?> should be <?php if(have_posts()): ?>.

  2. <?php $count ?> What does this mean. This is suppose to update your timer, but as it stand it has no function at all. One of the reasons I’m sure nothing worked. This should be <?php $count++ ?>

  3. ? > in <?php the_permalink(); ? > is a syntax error. Never lave a space between ? and >. Another reason why your code could not work.

  4. <?php. in <?php. the_title(); ?> Don’t add anything directly after the php tag, always leave a space. In this instance it might just be a typing error as the full stop has no meaning in that particular code, but it is bug

  5. You can simply just add a or and add a new counter to your code to display your ads after post 1 and 5. <?php if( $count==2 || $count==6 ): ?>

So your bug free and working code should look something like this

<?php if(have_posts()): ?>
    <?php $count=0; ?>
    <?php while( have_posts() ): the_post(); ?>
        <?php $count++ ?>
        <?php if( $count==2 || $count==6 ): ?>
            <div>Ads code here</div>
            <h2><a href="https://wordpress.stackexchange.com/questions/143973/<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
                <?php else: ?>
            <h2><a href="https://wordpress.stackexchange.com/questions/143973/<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
        <?php endif; ?>
    <?php endwhile; ?>
<?php endif; ?> 

EDIT

I forgot to add this. You should always when developing a theme/plugin, set your debug to true in wp-config.php. If you have done that, you would have been able to identify all of these bugs and rectify them before you have added your code to your question