• Resolved syniper

    (@syniper)


    Hello , i have been battling with an issue of adding an in feed ads showing up in category ,
    As we all know that newspaper works well when you are using the default template but after design my own template using the tag composer the ads stop showing up here is the code in the template that handles archive ( category) please can you tell me if there is any code i can add to it to make it work…

    <?php
    /**
    * Template use to render on the front end for single posts
    * – we start with the content context
    * tdb_state_template has a wp-query already, we only get in this template if a template is set, otherwise we load the
    * theme default template
    */
    get_header();
    global $wp_query;

    // save the content wp_query – mainly for the top black bar for now and to revert back to it at the end of the template
    tdb_state_content::set_wp_query($wp_query);

    // set the global wp_query as the template one
    $wp_query = tdb_state_template::get_wp_query();

    the_post();

    // run the template
    ?>
    <div class=”td-main-content-wrap td-container-wrap”>
    <div class=”tdc-content-wrap”>
    <?php the_content(); ?>
    </div>
    </div>
    <?php

    $wp_query = tdb_state_content::get_wp_query();
    $wp_query->rewind_posts();

    if ( have_posts() ) {
    // runs only when we have posts to avoid “Undefined offset 0” notice type error
    the_post();
    }

    get_footer();`
    `

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter syniper

    (@syniper)

    How can i add this to the above template archive

    // global $wp_query; // uncomment if loop content is in another file or function
    if( function_exists('the_ad_placement') && $wp_query->current_post === 4 ){ 
        the_ad_placement('between-posts');
    }
    Plugin Author Thomas Maier

    (@webzunft)

    Hi syniper,

    thanks for reaching out.

    The template you posted does not include a loop through various posts so it is not possible to inject an ad in between them. I don’t know if Newspaper has other templates you could edit, but maybe they can tell you.

    Otherwise, I would suggest using another method from this list to inject ads automatically between posts.

    Please let me know if you need anything else.

    Thomas

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post List Ads Not Working With Newspaper Theme’ is closed to new replies.