Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am so happy that I found this site =)

Well, here is my problem:

I want to display the wp comments right after the post, but before the plugins content.

What I have tried so far:

in single-products.php file, the original code is:

<?php the_content(); ?>
<?php wp_link_pages(array('before' => '<p><strong>'.__('Pages','eStore').':</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
<?php edit_post_link(__('Edit this page','eStore')); ?>

I tried put the comments(comments_template()) before and after the "the_content()", but its not correct. If I put:

  • Before the_content(), it displays the comments section before the real content

  • After the_content(), the comments are displayed below others plugin (simple social and Five rate stars plugins)

Is there anyway to insert in between them, I mean, between the post and plugins?

FYI: The theme that I am using, didnt display comment, so I have to display/enable it by myself. I am using wp 3.0.1

Plugin I am using:

  • Plugin Name: Five Star Rating (http://fsr.dingobytes.com)

  • Plugin Name: Simple Social - Sharing Widgets & Icons (Version: 0.2)

share|improve this question
    
what plugins are you referring to? –  sorich87 Oct 19 '10 at 6:56
    
Hi sorich: five-star rating and the simple-social plugin. –  wordpress_best Oct 19 '10 at 7:14
add comment

2 Answers 2

up vote 1 down vote accepted

For Five Star Rating, the FAQ tells me you can leave out the shortcode from your articles (you added these to each article?), and then use echo five_star_rating_func('star') somewhere in your template. So this is a nice example of a plugin that offers both options.

For Simple Social, you need to disable the regular hook to the_content, and then call the function yourself. That could be done with the following code, which you can place in your theme's functions.php (or at the top of your single.php, if you only want it gone on single pages):

remove_filter('the_content', 'simple_social');

Then, to display it again where you want it, you call simple_social() with an empty content string (be sure to do this in The Loop, since it relies on the global $post variable):

echo simple_social('');
share|improve this answer
    
works like charms.. thank you very much!!! =) –  wordpress_best Oct 19 '10 at 7:57
add comment

As I understand plugins you refer to add their output to the output of the_content() function. You can use the_content filter to achieve similar result in general.

But because it is filter - result is meant to be appended or otherwise included in data being passed, it's not a good place to load templates.

I think best way to approach this would be to disable plugins appending themselves to content (usually they have such option, they kinda should) and call them directly in template. That way you will be able to load comments template without issues and put it in order you want.

share|improve this answer
    
Hi, thanks for the answer. How do I call the plugins manually in php code? –  wordpress_best Oct 19 '10 at 6:50
    
@wordpress_best: This depends on the plugin, you should take a look at the code. Plugins can hook in multiple places, but most of them will use the_content, and thus use add_filter('the_content', [plugin function name]). If you tell us what plugins you use (edit your question to add it), we could give more specific information. –  Jan Fabry Oct 19 '10 at 6:57
    
Thanks Jan, i will update my question right now –  wordpress_best Oct 19 '10 at 7:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.