当前位置: 首页>>代码示例>>PHP>>正文


PHP comment_form函数代码示例

本文整理汇总了PHP中comment_form函数的典型用法代码示例。如果您正苦于以下问题:PHP comment_form函数的具体用法?PHP comment_form怎么用?PHP comment_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了comment_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: adventure_tours_comment_form_renderer

 /**
  * Comment form renderer function.
  *
  * @return void
  */
 function adventure_tours_comment_form_renderer()
 {
     $commenter = wp_get_current_commenter();
     $fields = array('author' => '<div class="row"><div class="col-sm-4">' . '<label for="author">' . esc_html__('Name', 'adventure-tours') . '*</label>' . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30" />' . '</div>', 'email' => '<div class="col-sm-4">' . '<label for="email">' . esc_html__('Email', 'adventure-tours') . '*</label>' . '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30" />' . '</div>', 'url' => '<div class="col-sm-4">' . '<label for="url">' . esc_html__('Website', 'adventure-tours') . '</label>' . '<input id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" />' . '</div></div>');
     $args = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_notes_before' => '', 'comment_notes_after' => '', 'comment_field' => '<label for="comment">' . esc_html__('Comment', 'adventure-tours') . '</label><textarea id="comment" name="comment"></textarea>', 'label_submit' => '', 'cancel_reply_link' => '<i class="fa fa-times"></i>');
     ob_start();
     comment_form($args);
     $formHtml = '<div class="comments__form">' . ob_get_clean() . '</div>';
     wp_enqueue_script('comment-reply');
     echo str_replace('<input name="submit" type="submit" id="submit" class="submit" value="" />', '<button type="submit" class="atbtn"><i class="atbtn__icon fa fa-comment"></i>' . esc_html__('Post Comment', 'adventure-tours') . '</button>', $formHtml);
 }
开发者ID:j-kenneth,项目名称:Expeero,代码行数:16,代码来源:comments.php

示例2: show_html

 public function show_html($atts)
 {
     $this->init_sc();
     if ('' !== $this->options->get('cgb_clist_in_page_content') && '' !== $this->options->get('cgb_adjust_output')) {
         // Show comments template in page content
         ob_start();
         include CGB_PATH . 'includes/comments-template.php';
         $out = ob_get_contents();
         ob_end_clean();
         return $out;
     } else {
         // Show comment form
         $out = '';
         if (comments_open()) {
             // Only show one form above the comment list. The form_in_page will not be displayed if form_above_comments and adjust_output is enabled
             if ('' !== $this->options->get('cgb_form_in_page') && ('' === $this->options->get('cgb_form_above_comments') || '' === $this->options->get('cgb_adjust_output'))) {
                 require_once CGB_PATH . 'includes/comments-functions.php';
                 ob_start();
                 comment_form(CGB_Comments_Functions::get_instance()->get_guestbook_comment_form_args());
                 $out .= ob_get_contents();
                 ob_end_clean();
             }
         } else {
             $out .= '<div id="respond" style="text-align:center">' . __('Guestbook is closed', 'comment-guestbook') . '</div>';
         }
         return $out;
     }
 }
开发者ID:amitmula,项目名称:amitandaastha.in,代码行数:28,代码来源:sc_comment-guestbook.php

示例3: thb_comments

 function thb_comments($form_args = array())
 {
     comments_template('', true);
     $form_args += array('title_reply' => __('Reply', 'thb_text_domain'));
     if (comments_open()) {
         comment_form($form_args);
     }
 }
开发者ID:alfredpp,项目名称:sarath-portfolio,代码行数:8,代码来源:helper.comments.php

示例4: API_form

 public function API_form()
 {
     $_GET['_display'] = $_GET['display'];
     $_GET['display'] = 'default';
     $_GET = iS::escapeStr($_GET);
     iCMS::hooks('enable_comment', true);
     iPHP::app('comment.func');
     return comment_form($_GET);
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:9,代码来源:comment.app.php

示例5: theme_comment_form

function theme_comment_form()
{
    $commenter = wp_get_current_commenter();
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $fields = array('author' => '<div class="field half-field">' . '<input class="' . ($req ? 'required' : '') . '" ' . ($req ? 'required' : '') . '  type="text" id="author" name="author" placeholder="Nombre" value="' . '" /></div>', 'email' => '<div class="field half-field">' . '<input class="' . ($req ? 'required' : '') . '" ' . ($req ? 'required' : '') . '  type="text" id="email" name="email" placeholder="E-mail" value="' . '" /></div>');
    $comment_field = '<div class="field">' . '<textarea class="' . ($req ? 'required' : '') . '" ' . ($req ? 'required' : '') . 'id="comment" name="comment" placeholder="Comentario" ></textarea></div>';
    $comment_notes_before = '';
    $comment_notes_after = '';
    $comments_args = array('fields' => $fields, '$logged_in_as' => $logged_in_as, 'comment_notes_before' => $comment_notes_before, 'comment_notes_after' => $comment_notes_after, 'comment_field' => $comment_field, 'title_reply' => 'Publicar comentario', 'label_submit' => 'Enviar');
    comment_form($comments_args);
}
开发者ID:pbrego,项目名称:wordpress-theme,代码行数:12,代码来源:functions.php

示例6: comment_form

 public static function comment_form($args = array())
 {
     $commenter = wp_get_current_commenter();
     $req = get_option('require_name_email');
     $required_attr = 'aria-required="true" required';
     $required_indicator = ' <span class="required">*</span>';
     $args['fields'] = array('author' => '<div class="comment-form-author form-group row"><label class="control-label col-sm-3" for="author">' . __('Name', 'wp-starter-theme') . ($req ? $required_indicator : '') . '</label><div class="col-sm-9"><input type="text" id="author" name="author" class="form-control" value="' . esc_attr($commenter['comment_author']) . '"' . ($req ? $required_attr : '') . '></div></div>', 'email' => '<div class="comment-form-email form-group row"><label class="control-label col-sm-3" for="email">' . __('Email', 'wp-starter-theme') . ($req ? $required_indicator : '') . '</label><div class="col-sm-9"><input type="email" id="email" name="email" class="form-control" value="' . esc_attr($commenter['comment_author_email']) . '"' . ($req ? $required_attr : '') . '></div></div>', 'url' => '<div class="comment-form-url form-group row"><label class="control-label col-sm-3" for="url">' . __('Website', 'wp-starter-theme') . '</label><div class="col-sm-9"><input type="url" id="url" name="url" class="form-control" value="' . esc_attr($commenter['comment_author_url']) . '"></div></div>');
     $args['comment_field'] = '<div class="comment-form-comment form-group row"><label class="control-label col-sm-3" for="comment">' . __('Comment', 'wp-starter-theme') . $required_indicator . '</label><div class="col-sm-9"><textarea id="comment" name="comment" class="form-control" rows="8"' . $required_attr . '></textarea></div></div>';
     $args['submit_field'] = '<div class="form-submit form-group row"><div class="col-sm-9 col-sm-offset-3">%1$s %2$s</div></div>';
     $args['class_submit'] = 'submit btn btn-primary';
     $args['format'] = 'html5';
     \comment_form($args);
 }
开发者ID:felixarntz,项目名称:wp-starter-theme,代码行数:13,代码来源:BootstrapComments.php

示例7: get_comments_tree

 function get_comments_tree($top)
 {
     global $coms;
     foreach ($top as $id) {
         $cid = $coms[$id]['id'];
         echo '<div style="margin:20px 0 10px 30px;" class="comment" comment_id="' . $cid . '">' . '<img src="/blog/_images/avatar_small/' . $coms[$id]['avatar'] . '" style="vertical-align:middle;border:#ccc 1px solid;padding:1px;margin-right:5px;" />' . '<a name="comm_' . $cid . '"></a>' . '<strong><u>' . $coms[$id]['user_name'] . '</u></strong> <span style="font-size:0.8em;color:#666;">' . $coms[$id]['post_date'] . '</span><br/>' . $coms[$id]['content'] . '<br/><br/><a href="?reply_to=' . $cid . '#comm_' . $cid . '" onclick="answerTo(' . $cid . ',this);return false;">ответить</a>';
         if (isset($_GET['reply_to']) && $_GET['reply_to'] == $cid) {
             echo comment_form($discussion_id, $cid);
             $form_generated = true;
         }
         if (count($coms[$id]['cc'])) {
             get_comments_tree($coms[$id]['cc']);
         }
         echo '</div>';
     }
 }
开发者ID:anatoliychakkaev,项目名称:webdesk,代码行数:16,代码来源:read.php

示例8: output

    function output($options)
    {
        global $dslc_active;
        $post_id = $options['post_id'];
        $show_fake = true;
        if (is_singular() && get_post_type() !== 'dslc_templates') {
            $post_id = get_the_ID();
            $show_fake = false;
        }
        $this->module_start($options);
        /* Module output starts here */
        ?>

				<div class="dslc-tp-comment-form">

					<?php 
        if ($show_fake) {
            ?>

						<div id="respond" class="comment-respond">
							<h3 id="reply-title" class="comment-reply-title">Leave a Comment</h3>
							<form action="http://localhost/livecomposer/wp-comments-post.php" method="post" id="commentform" class="comment-form" onsubmit="return(false)">
								<div class="comment-form-name"><input id="author" name="author" type=text value="John Doe" size="30" placeholder="Name *" aria-required="true"></div>
								<div class="comment-form-email"><input id="email" name="email" type=text value="johndoe@gmail.com" size="30" placeholder="Email *" aria-required="true"></div>
								<div class="comment-form-website"><input id="url" name="url" type=text value="http://johndoe.com" size="30" placeholder="Website"></div>
								<div class="comment-form-comment"><textarea id="comment" name="comment" placeholder="Comment" aria-required="true">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</textarea></div>
								<p class="form-submit">
									<input name="submit" type="submit" id="submit" value="SUBMIT YOUR COMMENT">
									<input type="hidden" name="comment_post_ID" value="14" id="comment_post_ID">
									<input type="hidden" name="comment_parent" id="comment_parent" value="0">
								</p>
							</form>
						</div><!-- #respond -->

					<?php 
        } else {
            global $commenter;
            comment_form(array('label_submit' => __('SUBMIT YOUR COMMENT', 'dslc_string'), 'cancel_reply_link' => 'cancel', 'comment_notes_before' => '', 'comment_notes_after' => '', 'title_reply' => __('Leave a Comment', 'dslc_string'), 'title_reply_to' => __('Reply to %s.', 'dslc_string'), 'comment_field' => '<div class="comment-form-comment"><textarea id="comment" name="comment" placeholder="' . __('Comment', 'dslc_string') . '" aria-required="true"></textarea></div>', 'fields' => apply_filters('comment_form_default_fields', array('author' => '<div class="comment-form-name"><input id="author" name="author" type=text value="' . esc_attr($commenter['comment_author']) . '" size="30" placeholder="' . __('Name', 'dslc_string') . ' *" aria-required="true" /></div>', 'email' => '<div class="comment-form-email"><input id="email" name="email" type=text value="' . esc_attr($commenter['comment_author_email']) . '" size="30" placeholder="' . __('Email', 'dslc_string') . ' *" aria-required="true" /></div>', 'url' => '<div class="comment-form-website"><input id="url" name="url" type=text value="' . esc_attr($commenter['comment_author_url']) . '" size="30" placeholder="' . __('Website', 'dslc_string') . '" /></div>'))), $post_id);
        }
        ?>

				</div><!-- dslc-tp-comment-form -->

			<?php 
        /* Module output ends here */
        $this->module_end($options);
    }
开发者ID:kanawanzx,项目名称:Clone,代码行数:47,代码来源:module.php

示例9: bwp_capt_comment_form

/**
 * Helper function to display the captcha below the comment input field in themes using comment_form() function
 *
 * Copyright (c) 2011 Jono Bruni <jbruni.com.br> - Free software, in the terms of the GNU General Public License.
 */
function bwp_capt_comment_form($args = array(), $post_id = null)
{
    global $bwp_capt;
    remove_action('comment_form_after_fields', array($bwp_capt, 'add_recaptcha'));
    remove_action('comment_form_logged_in_after', array($bwp_capt, 'add_recaptcha'));
    remove_filter('comment_form_defaults', array($bwp_capt, 'add_recaptcha_after_comment_field'));
    ob_start();
    do_action('bwp_recaptcha_add_markups');
    $recaptcha_html = ob_get_contents();
    ob_end_clean();
    if (isset($args['comment_notes_after'])) {
        $args['comment_notes_after'] .= $recaptcha_html;
    } else {
        $args['comment_notes_after'] = $recaptcha_html;
    }
    comment_form($args, $post_id);
}
开发者ID:nilmadhab,项目名称:webtutplus,代码行数:22,代码来源:class-bwp-recaptcha.php

示例10: rotary_edit_announcement

function rotary_edit_announcement()
{
    $comment_id = $_REQUEST['comment_id'];
    $announcement = get_comment($comment_id);
    $title = get_comment_meta($comment_id, 'announcement_title', true);
    $comment_post_ID = $announcement->comment_post_ID;
    $args = array('title_reply' => rotary_announcement_header($comment_post_ID, $title, 'edit'), 'comment_notes_after' => rotary_comment_notes_after(), 'logged_in_as' => '', 'label_submit' => __('Save Announcement'), 'id_form' => 'ajax-edit-announcement-form');
    ob_start();
    ?>
	    <div id="edit-announcement-<?php 
    echo $comment_id;
    ?>
-form">
			<?php 
    echo comment_form($args, $comment_post_ID);
    ?>
		</div>
	<?php 
    $return = ob_get_clean();
    echo $return;
    die;
}
开发者ID:nmedia82,项目名称:rotary,代码行数:22,代码来源:ajax-announcements.php

示例11: next_comments_link

</div>
			<div class="nav-next"><?php 
        next_comments_link(__('Newer Comments &rarr;', 'zerif'));
        ?>
</div>
		</nav><!-- #comment-nav-below -->
		<?php 
    }
    // check for comment navigation
    ?>

	<?php 
}
// have_comments()
?>

	<?php 
if (!comments_open() && '0' != get_comments_number() && post_type_supports(get_post_type(), 'comments')) {
    ?>
		<p class="no-comments"><?php 
    _e('Comments are closed.', 'zerif');
    ?>
</p>
	<?php 
}
?>

	<?php 
comment_form(array('comment_notes_after' => ''));
?>
</div><!-- #comments -->
开发者ID:robertoperata,项目名称:abf-labs.com,代码行数:31,代码来源:comments.php

示例12: allowed_tags

// re-format comment allowed tags
$comment_allowedtags = allowed_tags();
$comment_allowedtags = str_replace(array("\r\n", "\r", "\n"), '', $comment_allowedtags);
$comment_allowedtags_array = explode('&gt; &lt;', $comment_allowedtags);
$formatted_comment_allowedtags = '';
foreach ($comment_allowedtags_array as $item) {
    $formatted_comment_allowedtags .= '<code>';
    if ($comment_allowedtags_array[0] != $item) {
        $formatted_comment_allowedtags .= '&lt;';
    }
    $formatted_comment_allowedtags .= $item;
    if (end($comment_allowedtags_array) != $item) {
        $formatted_comment_allowedtags .= '&gt;';
    }
    $formatted_comment_allowedtags .= '</code> ';
}
$comment_allowed_tags = $formatted_comment_allowedtags;
unset($comment_allowedtags, $comment_allowedtags_array, $formatted_comment_allowedtags);
ob_start();
comment_form(array('class_submit' => 'btn btn-primary', 'fields' => array('author' => '<div class="form-group">' . '<label class="control-label col-md-2" for="author">' . __('Name', 'bootstrap-basic') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<div class="col-md-10">' . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' class="form-control" />' . '</div>' . '</div>', 'email' => '<div class="form-group">' . '<label class="control-label col-md-2" for="email">' . __('Email', 'bootstrap-basic') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<div class="col-md-10">' . '<input id="email" name="email" ' . ($html5 ? 'type="email"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' class="form-control" />' . '</div>' . '</div>', 'url' => '<div class="form-group">' . '<label class="control-label col-md-2" for="url">' . __('Website', 'bootstrap-basic') . '</label> ' . '<div class="col-md-10">' . '<input id="url" name="url" ' . ($html5 ? 'type="url"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_url']) . '" size="30" class="form-control" />' . '</div>' . '</div>'), 'comment_field' => '<div class="form-group">' . '<label class="control-label col-md-2" for="comment">' . _x('Comment', 'noun') . '</label> ' . '<div class="col-md-10">' . '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" class="form-control"></textarea>' . '</div>' . '</div>', 'comment_notes_after' => '<p class="help-block">' . sprintf(__('You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s', 'bootstrap-basic'), $comment_allowed_tags) . '</p>'));
/**
 * WordPress comment form does not support action/filter form and input submit elements. Rewrite these code when there is support available.
 * @todo Change form class modification to use WordPress hook action/filter when it's available.
 */
$comment_form = str_replace('class="comment-form', 'class="comment-form form form-horizontal', ob_get_clean());
echo $comment_form;
unset($comment_allowed_tags, $comment_form);
?>

</div><!-- #comments -->
开发者ID:cloakandpigeon,项目名称:wordpressTheme,代码行数:30,代码来源:comments.php

示例13: previous_comments_link

    <section class="col-md-12">
    
        <div class="wp-pagenavi">
        
             <div class="left"><?php 
    previous_comments_link(__('&laquo;', 'lookilite'));
    ?>
</div>
             <div class="right"><?php 
    next_comments_link(__('&raquo;', 'lookilite'));
    ?>
</div>
             
            <div class="clear"></div>
        </div>
        
    </section>

<?php 
}
?>

<div class="clear"></div>

<section class="col-md-12">
	
	<?php 
comment_form(array('label_submit' => __('Leave a reply', 'lookilite')));
?>

</section>
开发者ID:akashprabhakar,项目名称:wordpress,代码行数:31,代码来源:comments.php

示例14: printf

		<h2 class="comments-title">
			<?php 
    printf(_nx('One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'wolf'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>');
    ?>
		</h2>
	<?php 
}
// have_comments()
?>

	<?php 
$commenter = wp_get_current_commenter();
$req = get_option('require_name_email');
$aria_req = $req ? " aria-required='true'" : '';
$fields = array('comment_field' => '<p class="comment-form-comment"><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'wolf'), wp_login_url(apply_filters('the_permalink', get_permalink()))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out &raquo;</a>', 'wolf'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink()))) . '</p>', 'comment_notes_before' => '', 'comment_notes_after' => '', 'title_reply' => '', 'title_reply_to' => __('Leave a Reply to %s', 'wolf'), 'cancel_reply_link' => __('Cancel Reply', 'wolf'), 'label_submit' => __('Submit Comment', 'wolf'));
comment_form($fields);
?>

	<?php 
if (have_comments()) {
    ?>

		<ol class="comment-list">
			<?php 
    wp_list_comments(array('callback' => 'wolf_comment', 'style' => 'ol'));
    ?>
		</ol><!-- .comment-list -->

		<?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        ?>
开发者ID:estrategasdigitales,项目名称:dictobas,代码行数:31,代码来源:comments.php

示例15: _e

        ?>
</div>
			</nav><!-- #comment-nav-below -->
			<?php 
    }
    // check for comment navigation
    ?>

	<?php 
}
// have_comments()
?>

	<?php 
// If comments are closed and there are comments, let's leave a little note, shall we?
if (!comments_open() && '0' != get_comments_number() && post_type_supports(get_post_type(), 'comments')) {
    ?>
		<p class="no-comments"><?php 
    _e('Comments are closed.', 'sennzaversion3');
    ?>
</p>
	<?php 
}
?>

		<?php 
comment_form();
?>

	</div><!-- .columns -->
</div><!-- .row -->
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:31,代码来源:comments.php


注:本文中的comment_form函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。