Friday, June 7, 2013

Customizing h3 title inside the comment_form template

Customizing h3 title inside the comment_form template

I'm customizing comment_form function and I noticed that I can't control the layout of what's outside the form itself.
This is default layout of the comment_form:
<div id="respond">
    <h3 class="reply-title"></h3>
    <form>
        //blah blah blah
    </form>
</div>
I can customize "blah blah blah" with:
<?php

$myform = array(

    //the other blah blah blah

);

?>

<?php comment_form($myform); ?>
but I can't change h3 tag. Is there any workaround to that? Except for hardcoding the whole thing like this:
<div id="respond">

    <div class="cancel-comment-reply">
        <small><?php cancel_comment_reply_link(); ?></small>
    </div>

    <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
    <?php else : ?>
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

        <?php if ( is_user_logged_in() ) : ?>
        <p class="comment-hello">You are logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php" class="commenter-name"><?php echo $user_identity; ?></a>. You can leave a comment or you can <a href="<?php echo wp_logout_url(get_permalink()); ?>" class="comment-logout"><em>log out</em></a></p>

        <?php else : ?>
        <p class="author">
            <input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" />
            <label for="author">Name<span class="required">*</span> <?php if ($req) echo "(required)"; ?></label>
        </p>

        <p class="email">
            <input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" />
            <label for="email">E-mail<span class="required">*</span> <?php if ($req) echo "(required)"; ?></label>
        </p>

        <p class="url">
            <input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
            <label for="url">URL</label>
        </p>

        <p>
            <small>
                <strong>XHTML:</strong> Allowed tags:<br />
                <code><?php echo allowed_tags(); ?></code>
            </small>
        </p>
        <?php endif; ?>

        <div class="textarea"><textarea name="comment" id="comment" cols="" rows="10" tabindex="4"></textarea></div>

        <p>
            <?php comment_id_fields(); ?>
            <input name="submit" type="submit" id="submit" tabindex="5" value="Submit" />
        </p>
        <?php do_action('comment_form', $post->ID); ?>

    </form>
<?php endif; // If registration required and not logged in ?>
</div>'
PS: It is also imposible to set a "tabindex" to the submit button (input). PSS: I've tried google and stackexchange. hardcode everywhere.

No comments:

Post a Comment