Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Comments, trackbacks & pings (http://forum.bytesforall.com/forumdisplay.php?f=19)
-   -   [SOLVED] How do I place an embed above the post comment / submit button? (http://forum.bytesforall.com/showthread.php?t=13593)

azazure Apr 1, 2011 12:10 AM

[SOLVED] How do I place an embed above the post comment / submit button?
 
I am using a plugin for users to rate a post when they leave a comment (1 - 5 stars). It currently appears below the post comment button by default, but I would like it to appear above the post comment button. Here is the code I need to insert: <?php myrp_api_ratings_form_table(); ?>

I have been trying to insert this code in various places in the theme's comments.php file but am not having any luck. I also have not found anything by searching the forums. Anyone know? I am using
WordPress 3.1 and Atahualpa 3.6.4

Thanks

juggledad Apr 1, 2011 03:43 AM

the comment form is actually built by a WordPress function 'comment_form()' so that is what you would have to edit, however you could try using the 'comment_notes_after' argument (see http://codex.wordpress.org/Function_...e/comment_form) and edit the value in comments.php

azazure Apr 2, 2011 01:21 AM

Thank you. I've done a lot of reading and think I would be in over my head to modify a WP function - I don't even know where to find them. I was hoping to just modify the comments.php file as you suggested. I have tried adding my php line - <?php myrp_api_ratings_form_table(); ?> using every kind of format/syntax I could think of but I always get errors. Any thoughts?

if ($bfa_ata['show_xhtml_tags'] == "Yes") {
$comment_notes_after = '
<p class="thesetags clearfix">' .
sprintf(__('You can use %1$sthese HTML tags</a>','atahualpa'),
'<a class="xhtmltags" href="#" onclick="return false;">') . '</p>
<div class="xhtml-tags"><p><code>' . allowed_tags() . '
</code></p></div>',
myrp_api_ratings_form_table();
} else {
$comment_notes_after = '',
myrp_api_ratings_form_table();
}

Thank you.

juggledad Apr 2, 2011 04:58 AM

ahhh the issue of mixing HTML and PHP, you had the right idea, just have to format it correctly. Try this
HTML Code:

if ($bfa_ata['show_xhtml_tags'] == "Yes") {       
        $comment_notes_after = '<br><strong>hello paul</strong>
                <p class="thesetags clearfix">' .
                sprintf(__('You can use %1$sthese HTML tags</a>','atahualpa'),
                '<a class="xhtmltags" href="#" onclick="return false;">') . '</p>
                <div class="xhtml-tags"><p><code>' . allowed_tags() . '
                </code></p></div>'.myrp_api_ratings_form_table();
} else {
        $comment_notes_after = myrp_api_ratings_form_table();
}

When adding something to a string, you concatenate it using the period. You may want to add a <br> after the last </div> if it doesn't look right - so you would have
HTML Code:

</code></p></div><br>'.myrp_api_ratings_form_table();

azazure Apr 3, 2011 12:25 AM

Oh, I see. Well, I was close at least. Strange though, it did add the ratings box but placed it on top of the "Leave A Reply" comment box. It's not even inside of the comment box borders. I don't get it. I'll have to keep experimenting I guess, but at least I know how to mix html and php now. Thank you.

azazure May 30, 2011 01:24 PM

I finally figured out how to do it (with some help). To place something above the submit button you must insert your code in place of "comment_form($comment_form_settings);" at the bottom of your comments.php file. For my situation it now looks like this. Hope this helps.

<?php // Using the new function comment_form() with the custom settings $comment_form_settings
$args = array("comment_notes_after"=>myrp_api_ratings_form _table(null, true)); comment_form($args);
?>


All times are GMT -6. The time now is 04:47 AM.

Powered by vBulletin® Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.