How to add ads with in loop posts using cloud templates

Posted in: Newspaper
Post count: 11

Hello,

I’m currently using module 10 for loop posts, categories, and tags. and I have set up in the loop.php that ads get display every 3, 6 and 9 posts. Here is the code that I’m using:

if (have_posts()) {
    while ( have_posts() ) : the_post();
    $adcounter++;
        echo $td_template_layout->layout_open_element();

        if (class_exists($td_module_class)) {
            $td_mod = new $td_module_class($post);
            echo $td_mod->render();

            if (is_category() or is_tag() or is_home() or is_archive()) {
              if ($adcounter ==3) {
                echo do_shortcode('[td_block_ad_box spot_id="custom_ad_3"]');
              }
            }
            if (is_category() or is_tag() or is_home() or is_archive()) {
              if ($adcounter ==6) {
                echo do_shortcode('[td_block_ad_box spot_id="custom_ad_2"]');
              }
            }
            if (is_category() or is_tag() or is_home() or is_archive()) {
              if ($adcounter ==9) {
                echo do_shortcode('[td_block_ad_box spot_id="custom_ad_2"]');
              }
            }
        } else {
            td_util::error(__FILE__, 'Missing module: ' . $td_module_class);
        }

        echo $td_template_layout->layout_close_element();
        $td_template_layout->layout_next();
    endwhile; //end loop
    echo $td_template_layout->close_all_tags();


} else {

This is working with no problem. My issue is when I create a category template using the cloud library and I add the loop posts, the categories pages don’t show the ads within 3,6 or 9 posts. Is there anything that I need to add on the code above?

Thank you for your time,
Juan

  • This topic was modified 7 years by Juan.
  • This topic was modified 7 years by Juan.
Post count: 20685

Hi,

Ads in the cloud loop element are not possible at the moment. The cloud library loop element does not use the module you are referring to or share the same theme files. This would require you to modify the plugin files, the modifications will also be lost after an update.

This would be the loop file of the plugin, maybe you can modify this to display ads in it
https://www.screencast.com/t/yrT3506VGH8

Thanks

Post count: 11

Thank you for the reply. Will have to figure out how to add it to that plugin file. Awesome work btw. There is no theme like Newspaper.

Post count: 11

Simion, by any chance, do you know the code that I can put in the tdb_loop.php file to have ads added every 3, 6 and 9 posts?

Thanks in advance.

Post count: 20685

Hi,

I tried a few things, didn’t work unfortunately. I will add this on the list however and it will be considered for the loop element. Sorry for the inconvenience.

Post count: 11

No problem. Thank you for checking on this.

Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.