Yet Another Related Posts Plugin (YARPP)
[resolved] [Plugin: Yet Another Related Posts Plugin] How to Put Ads Between Text and List (4 posts)

  1. DanielB1974
    Posted 4 years ago #

    I'm using YARPP, and it's fantastic.

    However, I'd like to put some ads between the end of my text and the start of the related post list. However, I can't seem to do it. When I put the ads in my single-content.php, the ads end up after the list. How do I put my ads between the post content and the related post list?


  2. Workshopshed
    Posted 4 years ago #

    You can turn off the automatic placement of the related posts and then call the function in your theme directly

    <?php if (function_exists('related_posts') ) : related_posts(); endif; ?>

  3. DanielB1974
    Posted 4 years ago #

    Thank you. When I do that, though, my entire page disappears, so I'm not sure where to put the code. I think the problem is that I'm trying to put a conditional within an array. Here's my content-single.php currently:

    	global $post;
    				'id' => theme_get_post_id(),
    				'class' => theme_get_post_class(),
    				'title' => theme_get_meta_option($post->ID, 'theme_show_post_title') ? get_the_title() : '',
    				'before' => theme_get_metadata_icons('date,author,edit', 'header'),
    				'content' => '<!-- AddThis Button BEGIN -->
    <div class="addthis_toolbox addthis_default_style "><br>
    <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
    <a class="addthis_button_tweet"></a>
    <a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
    <a class="addthis_counter addthis_pill_style"></a>
    <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=*****"></script>
    <!-- AddThis Button END -->
    <div style="text-align:left; float:left; margin:5px 10px 10px 0"><script type="text/javascript"><!--
    google_ad_client = "*****";
    /* 300 x 280 */
    google_ad_slot = "*****";
    google_ad_width = 300;
    google_ad_height = 250;
    <script type="text/javascript"
    </script></div>'. theme_get_content(),
    				'after' => '<hr><br><center><script type="text/javascript"><!--
    google_ad_client = "*****";
    /* 468x60 */
    google_ad_slot = "*****;
    google_ad_width = 468;
    google_ad_height = 60;
    <script type="text/javascript"
    </script></center>'. theme_get_metadata_icons('', 'footer')

    Where should I put that code, please?

  4. Workshopshed
    Posted 4 years ago #

    Put it just before the ?>
    You don't need the <?php prefix as you already have one of those at the top.

    So the last 3 lines would be

    if (function_exists('related_posts') ) : related_posts(); endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yet Another Related Posts Plugin (YARPP)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic