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


PHP wp_get_current_commenter函数代码示例

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


在下文中一共展示了wp_get_current_commenter函数的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: bootstrap3_comment_form_fields

function bootstrap3_comment_form_fields($fields)
{
    $commenter = wp_get_current_commenter();
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $html5 = current_theme_supports('html5', 'comment-form') ? 1 : 0;
    $fields = array('author' => '<div class="form-group comment-form-author">' . '<label for="author">' . __('Name') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<input class="form-control" id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></div>', 'email' => '<div class="form-group comment-form-email"><label for="email">' . __('Email') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<input class="form-control" id="email" name="email" ' . ($html5 ? 'type="email"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></div>', 'url' => '<div class="form-group comment-form-url"><label for="url">' . __('Website') . '</label> ' . '<input class="form-control" id="url" name="url" ' . ($html5 ? 'type="url"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></div>');
    return $fields;
}
开发者ID:biirdy,项目名称:www,代码行数:9,代码来源:bootstrap-comments.php

示例3: ultra_filter_comment_fields

 /**
  * Filter the comment fields to get more custom HTML.
  * @param $fields
  */
 function ultra_filter_comment_fields($fields)
 {
     $commenter = wp_get_current_commenter();
     $req = get_option('require_name_email');
     $aria_req = $req ? " aria-required='true'" : '';
     $html_req = $req ? " required='required'" : '';
     $html5 = true;
     $fields['author'] = '<div class="comment-form-author"><input id="author" name="author" placeholder="' . esc_attr__('Name *', 'ultra') . '" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . $html_req . ' /></div>';
     $fields['email'] = '<div class="comment-form-email"><input id="email" name="email" placeholder="' . esc_attr__('Email *', 'ultra') . '" ' . ($html5 ? 'type="email"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_email']) . '" size="30" aria-describedby="email-notes"' . $aria_req . $html_req . ' /></div>';
     $fields['url'] = '<div class="comment-form-url"><input id="url" name="url" placeholder="' . esc_attr__('Website', 'ultra') . '" ' . ($html5 ? 'type="url"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></div>';
     return $fields;
 }
开发者ID:conao,项目名称:huso-theme,代码行数:16,代码来源:comments.php

示例4: zacklive_comment_form

 function zacklive_comment_form($args)
 {
     $commenter = wp_get_current_commenter();
     $req = get_option('require_name_email');
     $args['fields'] = array('author' => '
         <div class="comment-form-author form-group">
             <input id="author" name="author" class="form-control" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . ($req ? " aria-required='true'" : '') . ' placeholder="' . __('Your Name', 'zacklive') . ($req ? '*' : '') . '" />
         </div>
     ', 'email' => '
         <div class="comment-form-email form-group">
             <input id="email" name="email" class="form-control" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . ($req ? " aria-required='true'" : '') . ' placeholder="' . __('Your Email', 'zacklive') . ($req ? '*' : '') . '" />
         </div>
     ', 'url' => '
         <div class="comment-form-url last form-group">
             <input id="url" name="url" class="form-control" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" placeholder="' . __('Your Website', 'zacklive') . '" />
         </div>
     ');
     $args['comment_notes_before'] = "";
     $args['comment_notes_after'] = '';
     $args['label_submit'] = "Submit";
     $args['comment_field'] = '
     <div class="comment-form-comment form-group">
         <textarea id="comment" name="comment" class="form-control" cols="45" rows="8" aria-required="true" placeholder="' . __('Your Comment Here ...', 'zacklive') . '"></textarea>
     </div>
 ';
     return $args;
 }
开发者ID:Red4x,项目名称:zacklive,代码行数:27,代码来源:zacklive.php

示例5: bootswatch_comment_form_fields

/**
 * Alter comment form fields `Author`, `Email` and `Website`
 *
 * @param  Array $fields Fields.
 * @return Array         Fields altered.
 */
function bootswatch_comment_form_fields($fields)
{
    $commenter = wp_get_current_commenter();
    $req = get_option('require_name_email');
    $required = $req ? 'required' : '';
    $aria_required = $req ? 'true' : '';
    $div_tpl = '<div class="form-group comment-form-{{field}}">{{label}} {{input}}</div>';
    $label_tpl = '<label for="{{field}}" class="col-sm-2 control-label">{{label}}{{required}}</label>';
    $input_tpl = '<div class="col-sm-10"><input{{param}}></div>';
    $fields_parameters = array('author' => array('label' => __('Name'), 'type' => 'text', 'value' => esc_attr($commenter['comment_author']), 'required' => $required, 'aria-required' => $aria_required, 'size' => 30, 'maxlength' => 245), 'email' => array('label' => __('Email'), 'type' => 'email', 'value' => esc_attr($commenter['comment_author_email']), 'required' => $required, 'aria-required' => $aria_required, 'size' => 30, 'maxlength' => 100, 'describedby' => 'email-notes'), 'url' => array('label' => __('Website'), 'type' => 'url', 'value' => esc_attr($commenter['comment_author_url']), 'size' => 30, 'maxlength' => 200));
    foreach ($fields_parameters as $field => $parameter) {
        // Add some defaults to field.
        $parameter += array('id' => $field, 'name' => $field, 'class' => 'form-control');
        // Build <input>.
        $input = $input_tpl;
        foreach (array('name', 'id', 'type', 'value', 'required', 'aria-required', 'size', 'maxlength', 'describedby', 'class') as $p) {
            if (!empty($parameter[$p])) {
                $input = str_replace('{{param}}', sprintf(' %s="%s"{{param}}', $p, $parameter[$p]), $input);
            }
        }
        $input = str_replace('{{param}}', '', $input);
        // Build <label>.
        $label = $label_tpl;
        $label = str_replace('{{label}}', $parameter['label'], $label);
        $label = str_replace('{{required}}', !empty($parameter['required']) ? ' <span class="required">*</span>' : '', $label);
        // Build field <div>.
        $div = $div_tpl;
        $div = str_replace(array('{{input}}', '{{label}}', '{{field}}'), array($input, $label, $field), $div);
        // Add field to $fields array.
        $fields[$field] = $div;
    }
    return $fields;
}
开发者ID:kadimi,项目名称:bootswatch,代码行数:39,代码来源:comment-form.php

示例6: comments_template

function comments_template( $file = '/comments.php' ) {
	global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity;

	if ( ! (is_single() || is_page() || $withcomments) )
		return;

	$req = get_settings('require_name_email');
	$commenter = wp_get_current_commenter();
	extract($commenter);

	// TODO: Use API instead of SELECTs.
	if ( empty($comment_author) ) {
		$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date");
	} else {
		$author_db = $wpdb->escape($comment_author);
		$email_db  = $wpdb->escape($comment_author_email);
		$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND ( comment_approved = '1' OR ( comment_author = '$author_db' AND comment_author_email = '$email_db' AND comment_approved = '0' ) ) ORDER BY comment_date");
	}

	define('COMMENTS_TEMPLATE', true);
	$include = apply_filters('comments_template', TEMPLATEPATH . $file );
	if ( file_exists( $include ) )
		require( $include );
	else
		require( ABSPATH . 'wp-content/themes/default/comments.php');
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:26,代码来源:comment-functions.php

示例7: lrl_custom_form_filters

function lrl_custom_form_filters($args = array(), $post_id = null)
{
    global $id;
    $options = get_option('bootstrap_theme');
    $custom_comment_message = isset($options['comment_form_text']) ? $options['comment_form_text'] : null;
    if (null === $post_id) {
        $post_id = $id;
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $user = wp_get_current_user();
    $user_identity = $user->exists() ? $user->display_name : '';
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $fields = array('author' => '
			<div class="comment-form-author clearfix">' . ' ' . '<input id="author" name="author" placeholder="Enter your Name..." type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' />
			</div>', 'email' => '
			<div class="comment-form-email clearfix">
			' . '<input id="email" name="email" placeholder="Enter your Email Address..." type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' />
			</div>', 'url' => '
			<div class="comment-form-url clearfix">
			' . '<input id="url" name="url" placeholder="Enter your Website..." type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" />
			</div>');
    $required_text = sprintf(' ' . __('Required fields are marked %s', 'bootstrap'), '<span class="required">*</span>');
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>', '', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'bootstrap'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</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?</a>', 'bootstrap'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => null, 'comment_notes_after' => null, 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => sprintf(__('Have a Comment?', 'bootstrap'), apply_filters('lrl_comment_form_message', $custom_comment_message)), 'title_reply_to' => __('Leave a Reply to %s', 'bootstrap'), 'cancel_reply_link' => __('Cancel', 'bootstrap'), 'label_submit' => __('Submit Comment', 'bootstrap'));
    return $defaults;
}
开发者ID:scotlanddig,项目名称:bootstrap_basic,代码行数:28,代码来源:comments.php

示例8: momtaz_comment_form_args

/**
 * Filters the WordPress comment_form() function that was added in WordPress 3.0.  This allows
 * the theme to preserve some backwards compatibility with its old comment form.  It also allows
 * users to build custom comment forms by filtering 'comment_form_defaults' in their child theme.
 *
 * @since 1.0
 * @param array $defaults The default comment form arguments.
 * @return array $args The filtered comment form arguments.
 */
function momtaz_comment_form_args($defaults)
{
    $args = array();
    // Remove the notes after the form.
    $args['comment_notes_after'] = '';
    // Get current commenter's name, email, and URL.
    $commenter = wp_get_current_commenter();
    // Is the "Name" and "Email" fields are required?
    $required = (bool) get_option('require_name_email');
    /*** Comment Form Fields **************************************************/
    $args['fields'] = Nmwdhj\create_elements(array('author' => array('atts' => array('required' => (bool) $required), 'value' => $commenter['comment_author'], 'label' => __('Name', 'momtaz'), 'type' => 'input_text', 'nid' => 'author'), 'email' => array('atts' => array('required' => (bool) $required), 'value' => $commenter['comment_author_email'], 'label' => __('Email', 'momtaz'), 'type' => 'input_email', 'nid' => 'email'), 'url' => array('value' => $commenter['comment_author_url'], 'label' => __('Website', 'momtaz'), 'type' => 'input_url', 'nid' => 'url')));
    // Shared
    foreach ($args['fields'] as $k => $e) {
        if ($e->get_attr('required')) {
            $label = $e->get_option('label');
            if (!empty($label)) {
                $label .= '<span class="required">*</span>';
                $e->set_option('label', $label);
            }
        }
        $e->set_options(array('wrapper_atts' => array('class' => 'form-section layout-columned'), 'label_atts' => array('class' => 'form-label'), 'wrapper' => 'div'), true);
        $e->set_atts(array('class' => 'form-field regular-textbox', 'size' => 40));
        $args['fields'][$k] = $e->get_output();
    }
    // Comment Text
    $args['comment_field'] = Nmwdhj\create_element(array('type' => 'textarea', 'nid' => 'comment', 'atts' => array('class' => 'form-field large-textbox', 'required' => true, 'rows' => 10, 'cols' => 60), 'wrapper' => 'div', 'wrapper_atts' => array('class' => 'form-section layout-full')))->get_output();
    $args = wp_parse_args($args, $defaults);
    return $args;
}
开发者ID:mastinoz,项目名称:Momtaz-Framework,代码行数:38,代码来源:comments.php

示例9: progo_bootstrap3_comment_form_fields

function progo_bootstrap3_comment_form_fields($fields)
{
    $commenter = wp_get_current_commenter();
    $req = get_option('require_name_email');
    $required = $req ? ' aria-required="true" required ' : '';
    $fields = array('author' => '<div class="form-group comment-form-author">' . '<label for="author">' . __('Name', 'pgb') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<div class="input-group"><span class="input-group-addon glyphicon glyphicon-user"></span><input class="form-control" id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $required . ' /></div></div>', 'email' => '<div class="form-group comment-form-email"><label for="email">' . __('Email', 'pgb') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<div class="input-group"><span class="input-group-addon glyphicon glyphicon-envelope"></span><input class="form-control" id="email" name="email" type="email" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $required . ' /></div></div>', 'url' => '<div class="form-group comment-form-url"><label for="url">' . __('Website', 'pgb') . '</label> ' . '<div class="input-group"><span class="input-group-addon glyphicon glyphicon-globe"></span><input class="form-control" id="url" name="url" type="url" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></div></div>');
    return $fields;
}
开发者ID:nlk-sites,项目名称:nectar7,代码行数:8,代码来源:pgb-filters.php

示例10: ep_comment_fields

function ep_comment_fields($fields)
{
    $commenter = wp_get_current_commenter();
    $fields['author'] = "<div class=\"input-text\"><input name=\"author\" value=\"" . esc_attr($commenter['comment_author']) . "\" type=\"text\" tabindex=\"1\"><span class=\"label\">" . __('Your Name', 'epicomedia') . "</span><span class=\"graylabel\">" . __('Your Name', 'epicomedia') . "</span></div>";
    $fields['email'] = "<div class=\"input-text\"><input name=\"email\" value=\"" . esc_attr($commenter['comment_author_email']) . "\" type=\"text\" tabindex=\"2\"><span class=\"label\">" . __('Email', 'epicomedia') . "</span><span class=\"graylabel\">" . __('Email', 'epicomedia') . "</span></div>";
    $fields['url'] = "<div  class=\"input-text\"><input name=\"url\" value=\"" . esc_attr($commenter['comment_author_url']) . "\" type=\"text\" tabindex=\"3\"><span class=\"label\">" . __('WEBSITE', 'epicomedia') . "</span><span class=\"graylabel\">" . __('WEBSITE', 'epicomedia') . "</span></div>";
    return $fields;
}
开发者ID:rmilano24,项目名称:moto,代码行数:8,代码来源:comments.php

示例11: mixed_custom_comment_fields

function mixed_custom_comment_fields()
{
    $commenter = wp_get_current_commenter();
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $fields = array('author' => '<p>' . '<input id="author" name="author" type="text" class="form-control" placeholder="Name ( required )" value="' . esc_attr($commenter['comment_author']) . '" ' . $aria_req . ' />' . '</p>', 'email' => '<p>' . '<input id="email" name="email" type="text" class="form-control" placeholder="Email ( required )" value="' . esc_attr($commenter['comment_author_email']) . '" ' . $aria_req . ' />' . '</p>', 'url' => '<p>' . '<input id="url" name="url" type="text" class="form-control" placeholder="Website" value="' . esc_attr($commenter['comment_author_url']) . '" />' . '</p>');
    return $fields;
}
开发者ID:un1coin,项目名称:ovn-space,代码行数:8,代码来源:functions.php

示例12: aventurine_comment_fields

/**
 * Unset the website field, Remove the required *
 */
function aventurine_comment_fields($fields)
{
    $commenter = wp_get_current_commenter();
    unset($fields['url']);
    $fields['author'] = sprintf('<p class="comment-form-author"><label for="author">%1$s</label> <input id="author" name="author" type="text" value="%2$s" size="30" aria-required="true" placeholder="%1$s" /></p>', __('Name', 'aventurine'), esc_attr($commenter['comment_author']));
    $fields['email'] = sprintf('<p class="comment-form-email"><label for="email">%1$s</label><input id="email" name="email" type="email" value="%2$s" size="30" aria-required="true" placeholder="%1$s" /></p>', __('Email', 'aventurine'), esc_attr($commenter['comment_author_email']));
    return $fields;
}
开发者ID:Pellmellism,项目名称:aventurine,代码行数:11,代码来源:extras.php

示例13: wolf_change_comment_form_defaults

    /**
     * Hook to set the email input of the comment form as email type
     * (usefull for tablet and mobile)
     *
     * @param array $default
     * @return array $default
     */
    function wolf_change_comment_form_defaults($default)
    {
        $commenter = wp_get_current_commenter();
        $req = get_option('require_name_email');
        $aria_req = $req ? " aria-required='true'" : '';
        $default['fields']['email'] = '<p class="comment-form-email">
		<label for="email">' . __('Email', 'wolf') . ' ' . ($req ? '<span class="required">*</span>' : '') . '</label><input id="email" name="email" type="email" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></p>';
        return $default;
    }
开发者ID:estrategasdigitales,项目名称:dictobas,代码行数:16,代码来源:filters.php

示例14: modify_comment_form_fields

 function modify_comment_form_fields($fields)
 {
     $commenter = wp_get_current_commenter();
     $req = get_option('require_name_email');
     $fields['author'] = '<p class="inputrow"><input type="text" name="author" id="author" value="' . esc_attr($commenter['comment_author']) . '" placeholder="' . __("Name", "Vela") . ' (' . __('Required', 'Vela') . ')" size="22" tabindex="1"' . ($req ? ' required' : '') . ' /></p>';
     $fields['email'] = '<p class="inputrow"><input type="text" name="email" id="email" value="' . sanitize_email($commenter['comment_author_email']) . '" placeholder="' . __("Email", "Vela") . ' (' . __('Required', 'Vela') . ')" size="22" tabindex="2"' . ($req ? ' required' : '') . '  /></p>';
     $fields['url'] = '<p class="inputrow"><input type="text" name="url" id="url" value="' . esc_url($commenter['comment_author_url']) . '" placeholder="' . __("Website", "Vela") . '" size="22" tabindex="3" /></p>';
     return $fields;
 }
开发者ID:de190909,项目名称:WPTest,代码行数:9,代码来源:comments.php

示例15: flatter_comment_form_fields

function flatter_comment_form_fields($fields)
{
    $commenter = wp_get_current_commenter();
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $html5 = current_theme_supports('html5', 'comment-form') ? 1 : 0;
    $fields = array('author' => '<div class="col-sm-12 form-group comment-form-author">' . '<input class="form-control" id="author" name="author" type="text" placeholder="* Full Name" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></div>', 'email' => '<div class="col-sm-12 form-group comment-form-email">' . '<input class="form-control" id="email" placeholder="* Email Address" name="email" ' . ($html5 ? 'type="email"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></div>', 'url' => '<div class=" col-sm-12 form-group comment-form-url">' . '<input class="form-control" id="url" placeholder="Website" name="url" ' . ($html5 ? 'type="url"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></div>');
    return $fields;
}
开发者ID:drukaman,项目名称:pioneerweb,代码行数:9,代码来源:extras.php


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