• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

「関数リファレンス/comment form」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(en:Template Tags/comment_form 13:50, 5 July 2010 Bono 版を翻訳用にコピー)
 
(日本語版向けに調整)
1行目: 1行目:
 
{{Stub}}
 
{{Stub}}
 +
{{NeedTrans}}
 +
{{テンプレートタグガイド|PHP}}
  
 
== Description ==
 
== Description ==
9行目: 11行目:
 
== Usage ==
 
== Usage ==
  
%%%<?php comment_form( $args, $post_id ); ?>%%%
+
<?php comment_form( $args, $post_id ); ?>
  
 
=== Default Usage ===
 
=== Default Usage ===
 
%%%<?php comment_form(); ?>%%%
 
  
 
[[Image:twentytendefault6.png|thumb]]
 
[[Image:twentytendefault6.png|thumb]]
 +
 +
<?php comment_form(); ?>
 +
 
cf. {{Source|wp-content/themes/twentyten/comments.php}}
 
cf. {{Source|wp-content/themes/twentyten/comments.php}}
  
52行目: 55行目:
 
{{Parameter|id_form|string|value of the <code>id</code> attribute of <code>form</code> element (<code><nowiki><form></nowiki></code> tag).|optional|'commentform'}}
 
{{Parameter|id_form|string|value of the <code>id</code> attribute of <code>form</code> element (<code><nowiki><form></nowiki></code> tag).|optional|'commentform'}}
 
{{Parameter|id_submit|string|value of the <code>id</code> attribute of submit button.|optional|'submit'}}
 
{{Parameter|id_submit|string|value of the <code>id</code> attribute of submit button.|optional|'submit'}}
{{Parameter|title_reply|string|The title of comment form.|optional|[[Function Reference/_2|__]]( 'Leave a Reply' )}}
+
{{Parameter|title_reply|string|The title of comment form.|optional|[[関数リファレンス/_2|__]]( 'Leave a Reply' )}}
{{Parameter|title_reply_to|string|<!--description-->|optional|[[Function Reference/_2|__]]( 'Leave a Reply to %s' )}}
+
{{Parameter|title_reply_to|string|<!--description-->|optional|[[関数リファレンス/_2|__]]( 'Leave a Reply to %s' )}}
{{Parameter|cancel_reply_link|string|link label to cancel reply.|optional|[[Function Reference/_2|__]]( 'Cancel reply' )}}
+
{{Parameter|cancel_reply_link|string|link label to cancel reply.|optional|[[関数リファレンス/_2|__]]( 'Cancel reply' )}}
{{Parameter|label_submit|string|the name of submit button.|optional|[[Function Reference/_2|__]]( 'Post Comment' )}}
+
{{Parameter|label_submit|string|the name of submit button.|optional|[[関数リファレンス/_2|__]]( 'Post Comment' )}}
  
 
=== $fields ===
 
=== $fields ===
87行目: 90行目:
 
== Source Code ==
 
== Source Code ==
  
<code>comment_form()</code> is located in {{Source|wp-includes/comment-template.php}}. (WordPress {{CurrentVersion}})
+
<code>comment_form()</code> is located in {{Source|wp-includes/comment-template.php}}.
  
 
{{原文|Template Tags/comment_form|91050}}<!-- 13:50, 5 July 2010 Bono 版 -->
 
{{原文|Template Tags/comment_form|91050}}<!-- 13:50, 5 July 2010 Bono 版 -->
97行目: 100行目:
 
{{Tag Footer}}
 
{{Tag Footer}}
  
[[Category:Template Tags]]
+
{{DEFAULTSORT:Comment_form}}
[[Category:New page created]]
+
[[Category:コメント・トラックバック]]
 +
[[Category:wp3.0]]
  
 
[[en:Template Tags/comment_form]]
 
[[en:Template Tags/comment_form]]

2010年7月6日 (火) 01:26時点における版

このページ「関数リファレンス/comment form」はまだ書きかけで、情報が不足しています。続きを書いて WordPress を手助けしましょう.


このページ「関数リファレンス/comment form」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています

Description

This tag outputs a complete commenting form for use within a template.

Most strings and form fields may be controlled through the $args array passed into the function, while you may also choose to use the comments_form_default_fields filter to modify the array of default fields if you'd just like to add a new one or remove a single field. All fields are also individually passed through a filter of the form comments_form_field_$name where $name is the key used in the array of fields.

Usage

<?php comment_form( $args, $post_id ); ?>

Default Usage

<?php comment_form(); ?>

cf. wp-content/themes/twentyten/comments.php

Parameters

args
array) (optional) Options for strings, fields etc in the form.
初期値: (See below)
post_id
mixed) (optional) Post ID to generate the form for, uses the current post if null
初期値: null (the current post)

$args

Default value:

<?php $defaults = array(
	'fields'               => apply_filters( 'comment_form_default_fields', $fields ),
	'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><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.' ), 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>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
	'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
	'comment_notes_after'  => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>',
	'id_form'              => 'commentform',
	'id_submit'            => 'submit',
	'title_reply'          => __( 'Leave a Reply' ),
	'title_reply_to'       => __( 'Leave a Reply to %s' ),
	'cancel_reply_link'    => __( 'Cancel reply' ),
	'label_submit'         => __( 'Post Comment' ),
);
?>
fields
array) (optional) Input fields other than comment body, such as author, email, url.
初期値: apply_filters( 'comment_form_default_fields', $fields )
comment_field
string) (optional) The textarea and the label of comment body.
初期値:
must_log_in
string) (optional
初期値:
logged_in_as
string) (optional
初期値:
comment_notes_before
string) (optional) text or html tags befor comment form.
初期値:
comment_notes_after
string) (optional) text or html tags after comment body.
初期値:
id_form
string) (optional) value of the id attribute of form element (<form> tag).
初期値: 'commentform'
id_submit
string) (optional) value of the id attribute of submit button.
初期値: 'submit'
title_reply
string) (optional) The title of comment form.
初期値: __( 'Leave a Reply' )
title_reply_to
string) (optional
初期値: __( 'Leave a Reply to %s' )
cancel_reply_link
string) (optional) link label to cancel reply.
初期値: __( 'Cancel reply' )
label_submit
string) (optional) the name of submit button.
初期値: __( 'Post Comment' )

$fields

Default input items:

<?php
$fields =  array(
	'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
	            '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
	'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
	            '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
	'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label>' .
	            '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
); ?>

Return

void

Filter

Examples

customizing Input Fields

Changelog

Source Code

comment_form() is located in wp-includes/comment-template.php.

最新英語版: WordPress Codex » Template Tags/comment_form最新版との差分

Related

テンプレート:Comments Tags


関数リファレンステンプレートタグ目次もご覧ください。