WordPress.org

Ready to get started?Download WordPress

Forums

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
    Member
    Posted 2 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?

    http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/

  2. Workshopshed
    Member
    Posted 2 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
    Member
    Posted 2 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:

    <?php
    	global $post;
    	theme_post_wrapper(
    		array(
    				'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>
    </div>
    <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=*****"></script>
    <!-- AddThis Button END -->
    <hr>
    <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>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </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>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script></center>'. theme_get_metadata_icons('', 'footer')
    		)
    	);
    ?>

    Where should I put that code, please?

  4. Workshopshed
    Member
    Posted 2 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

About this Topic