PHP help needed for "Recent Comments" Wordpress plugin

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
julesfrog
Forum Newbie
Posts: 1
Joined: Mon Dec 15, 2008 11:46 am

PHP help needed for "Recent Comments" Wordpress plugin

Post by julesfrog »

Hello everyone,

I am a new comer here. I am a web designer who does a lot of XHTML and CSS, but very little PHP. As you may have read in the topic of this post, I am having a problem with some PHP code in Wordpress. I want to let you know that I have posted my problem on the Wordpress forum, but noone was able to help. So, I am asking now the real PHP masters.

This is what I wrote:

I am in the process of building a website for a client and will need to display on the frontpage the comments left in a subpage (not part of the blog). I chose to go with the "Recent Comments" plugin (http://blog.jodies.de/2004/11/recent-comments/) because it allows me to display only the comments from a page and not the blog. And here's my problem. I will try to make it as easy as possible:

I add to create an additional field to the comments area to display a title. To do so, I used another plugin called "Extra Comment Field" and created a new variable for the field I needed. I called it "recipe_name". I also included in the comments.php file the following lines:

Code: Select all

<p><?php print $comment->extra_recipe_name; ?></p>
just above

Code: Select all

<?php if ($comment->comment_approved == '0') : ?>
and:

Code: Select all

<input type="text" name="recipe_name" id="recipe_name" tabindex="4" size="22" />
in the form.

The new variable was created in my database and works as expected returning a value.

Now, in order to have the "Recent Comments" plugin recognize this new field, I read on the plugin website that I need to add a new function to the output_tags.php file following this template:

Code: Select all

function otf_postid ($option_key, $result, $ext) {
    return $result->ID;
}
So here it is. I spend 1 week trying to find an answer to this question. I even emailed the creator of the plugin but never got an answer. How do I get this function to return my "recipe_name" field? I attached the output_tag.php file if it helps.

Please help :-) Thanks!
Post Reply