Comment Hook Problem

It appears that when I insert the hooks that are in the comment_form.php file associated with my theme it completely throws off the layout of the theme.

Here is a link. I've also attach an image.

http://www.creativ3church.com/blog/for-you-designer-junkies-out-there/

  • DavidM
    • DEV MAN’s Mascot

    Hi creativ3group,

    I see what you mean. It seems to be sitting within the class 'grid_8' div. Any chance you could try adding it between the <article> tags?

    Also, are you sure your theme doesn't provide more comment hooks? I've seen themes with quite a number of potential places to add things like this.

    Cheers,
    David

  • Tyler Orr
    • Site Builder, Child of Zeus

    Still having no luck.

    Here is the comment_form.php file. Maybe you can help in identifying the correct hooks. The form does't show up unless I grab the top hook 'wp_get_current_commenter' but it completely crashes the layout when I do so.

    <?php if(!defined('BANDIT_INIT')) exit('No direct script access allowed'); ?>
    <?php use \BanditFramework\Helpers\BanditHelper as bandit; ?>
    
    <?php
    global $user_identity;
    $commenter = wp_get_current_commenter();
    ?>
    
    <form class="bandit-form" action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="commentform">
    
    	<header class="info">
    		<h4><?php comment_form_title(bandit::get_lang('comments_form_title_add'),bandit::get_lang('comments_form_title_reply')); ?></h4>
    		<?php cancel_comment_reply_link(bandit::get_lang('comments_form_cancel_reply')); ?>
    
    <?php if (is_user_logged_in()): ?>
    		<div>Logged in as <a href="<?php echo admin_url('profile.php'); ?>"><?php echo $user_identity; ?></a></div>
    	</header>
    
    	<ul>
    <?php else: ?>
    	</header>
    
    	<ul>
    		<li class="leftThird">
    			<label for="author" class="desc"><?php bandit::lang('comments_form_name'); ?>
    				<span class="req">*</span>
    			</label>
    			<div>
    				<input type="text" name="author" value="<?php echo esc_attr($commenter['comment_author']); ?>" id="author" class="field text medium">
    			</div>
    		</li>
    
    		<li class="middleThird">
    			<label for="email" class="desc"><?php bandit::lang('comments_form_email'); ?>
    				<span class="req">*</span>
    			</label>
    			<div>
    				<input type="text" name="email" value="<?php echo esc_attr($commenter['comment_author_email']); ?>" id="email" class="field text medium">
    			</div>
    		</li>
    
    		<li class="rightThird">
    			<label for="url" class="desc"><?php bandit::lang('comments_form_website'); ?></label>
    			<div>
    				<input type="text" name="url" value="<?php echo esc_attr($commenter['comment_author_url']); ?>" id="url" class="field text medium">
    			</div>
    		</li>
    <?php endif; ?>
    
    		<li>
    			<label for="comment" class="desc"><?php bandit::lang('comments_form_comment'); ?></label>
    			<div>
    				<textarea name="comment" id="comment" cols="50" rows="10" class="field textarea medium"></textarea>
    			</div>
    		</li>
    
    		<li class="buttons">
    			<div>
    				<input id="saveForm" name="saveForm" class="btTxt submit" type="submit" value="Submit" />
    			</div>
    		</li>
    	</ul>
    
    <?php comment_id_fields(); ?>
    <?php do_action('comment_form', $post->ID); ?>
    </form>
  • dunskii
    • Site Builder, Child of Zeus

    Howdy,

    Don't know if this will help, but I was having a similar issue not being able to find the right hooks so I ended up doing the following and seems to be working.

    I added <?php do_action('comment_form_start', $post->ID); ?> directly above <form action ......
    and
    <?php do_action('comment_form_end', $post->ID); ?> directly above </form>

    And it seems to be working, I get notified of the comment and comments are posted to walls etc if selected.

    Though for some reason once the comment is submitted, the facebook tab is selected, but thats an issue for another day, seeing as its just past beer o'clock on friday :wink:

    Good luck
    D

  • Philip John
    • DEV MAN’s Apprentice

    Hiya,

    Just checking if it was eventually resolved in another thread? Or by yourself separately to us? Or by us over email with you? Or using our live support?

    If so, no need to reply, that's great news.

    If not, could you let us know by re-opening this topic, and we'll get onto it and helping you out asap!

    Otherwise, happy days, glad you got it sorted :slight_smile:

    Thanks!
    Phil

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.