WordPress.org

Ready to get started?Download WordPress

Forums

Moose Candy Troubles (13 posts)

  1. userx
    Member
    Posted 9 years ago #

    Hey all - I've searched here and everywhere, but cannot figure this moose out.

    First of all, the moose candy plugin download needs serious updating. It seems to have been missing the opening php tag (<?php) among other things that rendered it unusable. So, I did my best by looking at solif plugins and this is what I constructed:

    <?php
    /*
    Plugin Name: Moose Candy
    Version: 0.3
    Plugin URI: http://
    Description: This plugin puts stuff between posts.
    Author: Jason Goldsmith
    Author URI: http://jason.goldsmith.us
    */

    $candy[2] = '<script type="text/javascript"><!--
    google_ad_client = "pub-removed";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_channel ="18742957876";
    google_ad_type = "text";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "663300";
    google_color_url = "663300";
    google_color_text = "000000";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>';

    $dropping = 1; function moosecandy($text) { global $dropping, $candy; if (isset($candy[$dropping])) { $the_date = "
    "; $the_date .= $candy[$dropping]; $the_date .= '
    '; $dropping++; $text = $the_date . "\n" . $text; } else { $dropping++;} return $text; } add_filter('the_date', 'moosecandy'); ?>

    Now, I'm trying to put adsense ads between my first and second posts but it isn't working right for some reason. The ads are showing but in strange places (like halfway behind my post's posted by, category, time, date, and edit info. links.

    How or what do I have to do to get the ads between the first and second posts?

    I'm running WP 1.2 with Azevedo's Gollum template. Here's my loop:

    <div id="maincontent">
    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>

    <div>
    <p class="storytitle" id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?>

    <div class="post">
    <?php the_content(); ?>
    </div>

    <div class="postoptions"><img src="themes/gollum/arrow-left-comments.gif" width="21" height="16" alt=""/><img src="themes/gollum/time.gif" alt="Time"/> Posted By: ">
    <?php the_author(); ?>
    @ <?php the_date();?> <?php the_category(',') ?> <?php comments_popup_link(__('<img src="themes/gollum/comment.gif" alt=""/> Comment'), __('<img src="themes/gollum/comment.gif" alt=""/> Comment'), __('<img src="themes/gollum/comment.gif" alt=""/> Comment (%)')); ?> <?php edit_post_link(); ?>/wp-print.php?p=<?=the_ID()?>">Print</div>

    <?php wp_link_pages(); ?>

    <!--
    <?php trackback_rdf(); ?>
    -->

    <?php include(ABSPATH . 'wp-comments.php'); ?>
    </div>

    <?php endforeach; else: ?>
    <?php author(true, 5); ?>
    <?php endif; ?>

    <?php if ($single) { ?>

      <b>Related Articles:</b> <?php related_posts(); ?>

    <?php } ?>
    </div>

  2. userx
    Member
    Posted 9 years ago #

    Anyone?

  3. Anonymous
    Member
    Posted 9 years ago #

    I don't rate your chances, sorry. The plugin author seems not to be around anymore. Have you tried looking for alternative plugins with the same functionality?

  4. John
    Member
    Posted 9 years ago #

    Put <?php moosecandy("blah");?> after <b>Related Articles:</b> <?php related_posts(); ?>

  5. error
    Member
    Posted 9 years ago #

    Try Moose Candy 1.2.0 at http://jason.goldsmith.us/wp-plugins/moosecandy.phps it actually works. :)

    Oh, and you should definitely not have a call to moosecandy() in the loop. Very strange things will happen which won't be what you want.

  6. John
    Member
    Posted 9 years ago #

    If he posts it out side the loop it will only occur at the bottom of his posts

  7. userx
    Member
    Posted 9 years ago #

    Nope, nothing seems to be working. The Moose Candy I'm using is 1.2.0. The download, as is, doesn't even load into the plugins correctly (wp-content/plugins).

    Are there other alternatives for inlcuding google adsense? I've searched these forums and google but haven't found anything that actually works.

  8. error
    Member
    Posted 9 years ago #

    Since you haven't really stated WHAT the problem is, I don't think too many people (not even NuclearMoose!) will be able to help. Aside from that, you probably have extra spaces or blank lines after the ?> at the end of the file. Take those out.

    Or just put it directly into index.php. The catch is it will appear above the first post (and on every page). Mine looks like:

    <div class="googlesyndication"><p><script type="text/javascript"><!--
    google_ad_client = "pub-000000000000000";
    google_alternate_ad_url = "http://www.ioerror.us/wp-content/google_adsense_script.html";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_channel ="";
    google_page_url = document.location;
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "000099";
    google_color_url = "006600";
    google_color_text = "000000";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script></p></div>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?> (this last line is the start of the loop)

    If you really want it to be between the first and second posts, it'll have to be Moose Candy.

  9. userx
    Member
    Posted 9 years ago #

    Thanks people for all your help...I think I have it.

  10. ablewave
    Member
    Posted 9 years ago #

    Hi everyone. I have gotten Moosecandy to work fine to display text (thanks Jason), but what I really need it to do is include a file at that spot. Can someone provide a sample of what would go here:

    $candy[2] = 'file include reference';

    Thanks much. All assistance greatly appreciated.

  11. NuclearMoose
    Member
    Posted 9 years ago #

    Just so everyone knows, Jason Goldsmith created this plugin after he and I had a chat about some stuff I was looking for. He named it "Moose Candy" for fun. I did not have anything to do with the code, only part of the concept. As I've said before, I can only spell PHP. :)

    If this now works for WP 1.5, I'd sure appreciate someone posting the necessary changes so that others can use it if they so wish.

  12. innerchild
    Member
    Posted 9 years ago #

    heloo everybody
    does someone know if plugin works with 1.5 ??

    any other stuff that works equaly to this stuff for WP1.5 ?

  13. davidchait
    Member
    Posted 9 years ago #

    I discussed how to do this type of thing yourself in your index.php:
    http://wordpress.org/support/topic.php?id=29521

    -d

Topic Closed

This topic has been closed to new replies.

About this Topic