• Resolved Abhishek

    (@abhishe11sharma)


    Hi WordPress Experts

    I want to place ad code without any plugins, so please tell me how to do it?

    I placed ad code on index php but category and tag php have diffrent code, here is example:

    Index.php:

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    <?php get_template_part( ‘content’, get_post_format() ); ?>
    <?php endwhile; ?>

    category and tag php:

    <?php
    /* Start the Loop */
    while ( have_posts() ) : the_post();

    /* Include the post format-specific template for the content. If you want to
    * this in a child theme then include a file called called content-___.php
    * (where ___ is the post format) and that will be used instead.
    */
    get_template_part( ‘content’, get_post_format() );

    endwhile;

    I am using this code on index php:

    <?php /* Start the Loop */ ?>
    <?php $count = 1; ?>
    <?php while ( have_posts() ) : the_post(); ?>
    <?php get_template_part( ‘content’, get_post_format() ); ?>
    <?php if ($count == 1) : ?>
    //ad code……
    <?php endif; $count++; ?>
    <?php endwhile; ?>

    Please tell me a working solution as soon as possible.

    Thanks in Advance

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to add ad code in category and tag page’ is closed to new replies.