Fatal error: Cannot redeclare get_comment_author() (previously declared in /hermes/waloraweb037/b462/moo.teamtrimarkcom/wp-includes/comment.php:22) in /hermes/waloraweb037/b462/moo.teamtrimarkcom/wp-includes/comment-template.php on line 45
Website is www.teamtrimark.com
]]><h3 id="reply-title">
This div is located in comment-template.php. (line 1554)
I try to never touch the core file but I can’t think of a way to add a class to this div.
Can anyone help me?
]]>I have found tons of topics on how to add and alter fields in the comment form but I am having a hard time finding any help on altering other parts of the comment_form.
I want to add an <a href="">
and a class “show_hide” to the “Leave a reply” title (#reply-title), and enclose the rest of the comment form in a div with the class of “slidingDiv”. The effect is to allow the user to toggle the comment form by clicking on “Leave a reply” per this jquery tutorial: https://papermashup.com/simple-jquery-showhide-div/.
I was able to create the effect successfully by adding these elements to the comment_form portion of the wp-includes/comment-template.php file, but of course I DO NOT want to touch that file, so I am trying to figure out how to make this happen through my theme.
Here is the successful alteration to the code in /wp-includes/comment-template.php starting with line 1557 where i started my edits, and ending on line 1584 where I closed the div:
<h3 id="reply-title"><a href="#" class="show_hide"><?php comment_form_title( $args['title_reply'], $args['title_reply_to'] ); ?></a> <small><?php cancel_comment_reply_link( $args['cancel_reply_link'] ); ?></small></h3>
<?php if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) : ?>
<?php echo $args['must_log_in']; ?>
<?php do_action( 'comment_form_must_log_in_after' ); ?>
<?php else : ?>
<div class="slidingDiv"><form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="<?php echo esc_attr( $args['id_form'] ); ?>">
<?php do_action( 'comment_form_top' ); ?>
<?php if ( is_user_logged_in() ) : ?>
<?php echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); ?>
<?php do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); ?>
<?php else : ?>
<?php echo $args['comment_notes_before']; ?>
<?php
do_action( 'comment_form_before_fields' );
foreach ( (array) $args['fields'] as $name => $field ) {
echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
}
do_action( 'comment_form_after_fields' );
?>
<?php endif; ?>
<?php echo apply_filters( 'comment_form_field_comment', $args['comment_field'] ); ?>
<?php echo $args['comment_notes_after']; ?>
<p class="form-submit">
<input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" />
<?php comment_id_fields( $post_id ); ?>
</p>
<?php do_action( 'comment_form', $post_id ); ?>
</form></div>
What I added was <a href="#" class="show_hide">
to #reply-title and <div class="slidingDiv">
around the form.
So I have been trying to just include this alteration in a function and call up that function in my theme’s comments.php file, which usually uses the <?php comment_form(); ?>
– but I am not a .php wiz, and can’t seem to figure it out.
Here is a link to the test site, thought it won’t do much good, this is more of a concept to address, not really a problem that is on the site: https://www.jeannenemcek.com/beta/test-post-10/
Any help is greatly appreciated!
-Mattron
Warning: Cannot modify header information – headers already sent by (output started at …/wp-includes/comment-template.php:1552) in …/wp-includes/pluggable.php on line 866
today it wont let me on the site itself & it is giving me the same message. What happened and how do i fix it?
]]>here a page where you can see the two errors below
https://nanostream.net/?p=8
Warning: require(wp-includes/theme-compat/comments.php) [function.require]: failed to open stream: No such file or directory in /home4/techtro2/public_html/nanostream/wp-includes/comment-template.php on line 893
Fatal error: require() [function.require]: Failed opening required ‘wp-includes/theme-compat/comments.php’ (include_path=’.:/usr/lib64/php:/usr/lib/php:/usr/share/pear’) in /home4/techtro2/public_html/nanostream/wp-includes/comment-template.php on line 893
Tell me if you need more info thank you in advance.
]]>I’d like to filter into (through my child template’s function.php) comment-template.php to change the url. How do I do that?
Thank you, Tonya
]]>Almost everything is in some way customizable via css, template files or functions.php, but trying to customize the structure and layout of the “Reply” form (that follows a blog post) is buried in the deepest parts of wp-settings and wp-config files. I have no idea why this is different.
In the “comment-template.php” include file (in wp-includes) the commented section says that you can add variables to the $defaults array…but is this change permanent or will it just be overwritten during the next WP update?
Does anybody know?
]]>I revised the Codex comment-template.php and found this in lines 1368-1370:
1366 <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
1367 <?php
1368 /* translators: 1: date, 2: time */
1369 printf( __('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'??','' );
1370 ?>
Its seems some htmlspecialchars are not correctly displayed…
I had to delete some code here and leave only:
<?php edit_comment_link(__('(Edit)'),'??','' ); ?>
What I’m doing wrong?
Thanks a lot!
jeanloui
]]>I have a custom url setup, which is as follows:
parent category -> custom taxonomy term -> post
This makes the path look like this:
https://www.ecodelphinus.com/chronisch-zieken-gehandicapten/wwb/indien-iemand-chronisch-ziek-of-gehandicapt-is-in-de-wwb-is-het-verstandiger-als-die-persoon-gebruik-kan-maken-van-de-ziektewet.html
Now this works fine, but I noticed that when a comment is submitted the webpage is rerouted to a different path after submission.
Which is as follows:
parent category -> child category -> post
This makes the path look like this:
https://www.ecodelphinus.com/chronisch-zieken-gehandicapten/beleid/indien-iemand-chronisch-ziek-of-gehandicapt-is-in-de-wwb-is-het-verstandiger-als-die-persoon-gebruik-kan-maken-van-de-ziektewet.html/comment-page-1#comment-31
Besides being a different path, this also breaks my breadcrumbs and the comment under review is not shown to the visitor.
How do I reroute the submit function to a custom url?
Is there any documentation on this?
Edit:
I should note that by design a single post can have different paths:
parent category A -> taxonomy term 1 -> post A
parent category A -> taxonomy term 2 -> post A
So any solution should be able to distinguish from that.
]]>