dfdf dfdf
asked 6 years ago

What do I have to edit to get this done? I’m thinking of a banner ad.

3 Answers
Kido D
answered 6 years ago

Hi there,
To place banner ads between question and the first answer, you can open up the single-question.php in plugins/dw-question-answer/inc/templates/default folder, find the code below (around line 231):

 </article><!-- end question -->

.. and change it into this:

 </article><!-- end question -->
<div class="dwqa-banner">
Your ads goes here...
</div>

Regards,

dfdf dfdf
replied 6 years ago

Thank you, works!

Guru
replied 6 years ago

Thought so ;).

Jonathan
answered 6 years ago

I’m didn’t use this plugin but try to open /inc/templates/default/archive-question.php then find…

 <?php while ( have_posts() ) : the_post(); ?>
<?php dwqa_load_template( 'content', 'question' ); ?>
<?php endwhile; ?>

then edit like as below.

                 <?php $num = 9; ?>
		<?php while ( have_posts() ) : the_post(); $num++ ?>
                        <?php if ($num == 1) {?>
                        <!--YOUR BANNER AD CODE HERE-->
			<?php dwqa_load_template( 'content', 'question' ); ?>
                        <?php } else {?>
			<?php dwqa_load_template( 'content', 'question' ); ?>
		<?php endwhile; ?>
dfdf dfdf
replied 6 years ago

Thanks for your help!
I’ve done what you suggested but it doesn’t work, I can’t get the ad to display there.

My code would look something like this, right? Maybe I messed it up.

< ?php while ( have_posts() ) : the_post(); ?>
< ?php $num = 9; ?>
< ?php while ( have_posts() ) : the_post(); $num++ ?>
< ?php if ($num == 1) {?>

< ?php dwqa_load_template( 'content', 'question' ); ?>
< ?php } else {?>
< ?php dwqa_load_template( 'content', 'question' ); ?>
< ?php endwhile; ?>
Guru
answered 6 years ago

I think you have place the ad code in /inc/templates/default/single-question.php rather than the /inc/templates/default/archive-question.php

Powered by DW Question & Answer Pro