Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-inclu...
File: comment-template.php
* @param string $link_url Cancel comment reply link URL.
[2000] Fix | Delete
* @param string $link_text Cancel comment reply link text.
[2001] Fix | Delete
*/
[2002] Fix | Delete
return apply_filters( 'cancel_comment_reply_link', $cancel_comment_reply_link, $link_url, $link_text );
[2003] Fix | Delete
}
[2004] Fix | Delete
[2005] Fix | Delete
/**
[2006] Fix | Delete
* Displays HTML content for cancel comment reply link.
[2007] Fix | Delete
*
[2008] Fix | Delete
* @since 2.7.0
[2009] Fix | Delete
*
[2010] Fix | Delete
* @param string $link_text Optional. Text to display for cancel reply link. If empty,
[2011] Fix | Delete
* defaults to 'Click here to cancel reply'. Default empty.
[2012] Fix | Delete
*/
[2013] Fix | Delete
function cancel_comment_reply_link( $link_text = '' ) {
[2014] Fix | Delete
echo get_cancel_comment_reply_link( $link_text );
[2015] Fix | Delete
}
[2016] Fix | Delete
[2017] Fix | Delete
/**
[2018] Fix | Delete
* Retrieves hidden input HTML for replying to comments.
[2019] Fix | Delete
*
[2020] Fix | Delete
* @since 3.0.0
[2021] Fix | Delete
* @since 6.2.0 Renamed `$post_id` to `$post` and added WP_Post support.
[2022] Fix | Delete
*
[2023] Fix | Delete
* @param int|WP_Post|null $post Optional. The post the comment is being displayed for.
[2024] Fix | Delete
* Defaults to the current global post.
[2025] Fix | Delete
* @return string Hidden input HTML for replying to comments.
[2026] Fix | Delete
*/
[2027] Fix | Delete
function get_comment_id_fields( $post = null ) {
[2028] Fix | Delete
$post = get_post( $post );
[2029] Fix | Delete
if ( ! $post ) {
[2030] Fix | Delete
return '';
[2031] Fix | Delete
}
[2032] Fix | Delete
[2033] Fix | Delete
$post_id = $post->ID;
[2034] Fix | Delete
$reply_to_id = _get_comment_reply_id( $post_id );
[2035] Fix | Delete
[2036] Fix | Delete
$comment_id_fields = "<input type='hidden' name='comment_post_ID' value='$post_id' id='comment_post_ID' />\n";
[2037] Fix | Delete
$comment_id_fields .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$reply_to_id' />\n";
[2038] Fix | Delete
[2039] Fix | Delete
/**
[2040] Fix | Delete
* Filters the returned comment ID fields.
[2041] Fix | Delete
*
[2042] Fix | Delete
* @since 3.0.0
[2043] Fix | Delete
*
[2044] Fix | Delete
* @param string $comment_id_fields The HTML-formatted hidden ID field comment elements.
[2045] Fix | Delete
* @param int $post_id The post ID.
[2046] Fix | Delete
* @param int $reply_to_id The ID of the comment being replied to.
[2047] Fix | Delete
*/
[2048] Fix | Delete
return apply_filters( 'comment_id_fields', $comment_id_fields, $post_id, $reply_to_id );
[2049] Fix | Delete
}
[2050] Fix | Delete
[2051] Fix | Delete
/**
[2052] Fix | Delete
* Outputs hidden input HTML for replying to comments.
[2053] Fix | Delete
*
[2054] Fix | Delete
* Adds two hidden inputs to the comment form to identify the `comment_post_ID`
[2055] Fix | Delete
* and `comment_parent` values for threaded comments.
[2056] Fix | Delete
*
[2057] Fix | Delete
* This tag must be within the `<form>` section of the `comments.php` template.
[2058] Fix | Delete
*
[2059] Fix | Delete
* @since 2.7.0
[2060] Fix | Delete
* @since 6.2.0 Renamed `$post_id` to `$post` and added WP_Post support.
[2061] Fix | Delete
*
[2062] Fix | Delete
* @see get_comment_id_fields()
[2063] Fix | Delete
*
[2064] Fix | Delete
* @param int|WP_Post|null $post Optional. The post the comment is being displayed for.
[2065] Fix | Delete
* Defaults to the current global post.
[2066] Fix | Delete
*/
[2067] Fix | Delete
function comment_id_fields( $post = null ) {
[2068] Fix | Delete
echo get_comment_id_fields( $post );
[2069] Fix | Delete
}
[2070] Fix | Delete
[2071] Fix | Delete
/**
[2072] Fix | Delete
* Displays text based on comment reply status.
[2073] Fix | Delete
*
[2074] Fix | Delete
* Only affects users with JavaScript disabled.
[2075] Fix | Delete
*
[2076] Fix | Delete
* @internal The $comment global must be present to allow template tags access to the current
[2077] Fix | Delete
* comment. See https://core.trac.wordpress.org/changeset/36512.
[2078] Fix | Delete
*
[2079] Fix | Delete
* @since 2.7.0
[2080] Fix | Delete
* @since 6.2.0 Added the `$post` parameter.
[2081] Fix | Delete
*
[2082] Fix | Delete
* @global WP_Comment $comment Global comment object.
[2083] Fix | Delete
*
[2084] Fix | Delete
* @param string|false $no_reply_text Optional. Text to display when not replying to a comment.
[2085] Fix | Delete
* Default false.
[2086] Fix | Delete
* @param string|false $reply_text Optional. Text to display when replying to a comment.
[2087] Fix | Delete
* Default false. Accepts "%s" for the author of the comment
[2088] Fix | Delete
* being replied to.
[2089] Fix | Delete
* @param bool $link_to_parent Optional. Boolean to control making the author's name a link
[2090] Fix | Delete
* to their comment. Default true.
[2091] Fix | Delete
* @param int|WP_Post|null $post Optional. The post that the comment form is being displayed for.
[2092] Fix | Delete
* Defaults to the current global post.
[2093] Fix | Delete
*/
[2094] Fix | Delete
function comment_form_title( $no_reply_text = false, $reply_text = false, $link_to_parent = true, $post = null ) {
[2095] Fix | Delete
global $comment;
[2096] Fix | Delete
[2097] Fix | Delete
if ( false === $no_reply_text ) {
[2098] Fix | Delete
$no_reply_text = __( 'Leave a Reply' );
[2099] Fix | Delete
}
[2100] Fix | Delete
[2101] Fix | Delete
if ( false === $reply_text ) {
[2102] Fix | Delete
/* translators: %s: Author of the comment being replied to. */
[2103] Fix | Delete
$reply_text = __( 'Leave a Reply to %s' );
[2104] Fix | Delete
}
[2105] Fix | Delete
[2106] Fix | Delete
$post = get_post( $post );
[2107] Fix | Delete
if ( ! $post ) {
[2108] Fix | Delete
echo $no_reply_text;
[2109] Fix | Delete
return;
[2110] Fix | Delete
}
[2111] Fix | Delete
[2112] Fix | Delete
$reply_to_id = _get_comment_reply_id( $post->ID );
[2113] Fix | Delete
[2114] Fix | Delete
if ( 0 === $reply_to_id ) {
[2115] Fix | Delete
echo $no_reply_text;
[2116] Fix | Delete
return;
[2117] Fix | Delete
}
[2118] Fix | Delete
[2119] Fix | Delete
// Sets the global so that template tags can be used in the comment form.
[2120] Fix | Delete
$comment = get_comment( $reply_to_id );
[2121] Fix | Delete
[2122] Fix | Delete
if ( $link_to_parent ) {
[2123] Fix | Delete
$comment_author = sprintf(
[2124] Fix | Delete
'<a href="#comment-%1$s">%2$s</a>',
[2125] Fix | Delete
get_comment_ID(),
[2126] Fix | Delete
get_comment_author( $reply_to_id )
[2127] Fix | Delete
);
[2128] Fix | Delete
} else {
[2129] Fix | Delete
$comment_author = get_comment_author( $reply_to_id );
[2130] Fix | Delete
}
[2131] Fix | Delete
[2132] Fix | Delete
printf( $reply_text, $comment_author );
[2133] Fix | Delete
}
[2134] Fix | Delete
[2135] Fix | Delete
/**
[2136] Fix | Delete
* Gets the comment's reply to ID from the $_GET['replytocom'].
[2137] Fix | Delete
*
[2138] Fix | Delete
* @since 6.2.0
[2139] Fix | Delete
*
[2140] Fix | Delete
* @access private
[2141] Fix | Delete
*
[2142] Fix | Delete
* @param int|WP_Post $post The post the comment is being displayed for.
[2143] Fix | Delete
* Defaults to the current global post.
[2144] Fix | Delete
* @return int Comment's reply to ID.
[2145] Fix | Delete
*/
[2146] Fix | Delete
function _get_comment_reply_id( $post = null ) {
[2147] Fix | Delete
$post = get_post( $post );
[2148] Fix | Delete
[2149] Fix | Delete
if ( ! $post || ! isset( $_GET['replytocom'] ) || ! is_numeric( $_GET['replytocom'] ) ) {
[2150] Fix | Delete
return 0;
[2151] Fix | Delete
}
[2152] Fix | Delete
[2153] Fix | Delete
$reply_to_id = (int) $_GET['replytocom'];
[2154] Fix | Delete
[2155] Fix | Delete
/*
[2156] Fix | Delete
* Validate the comment.
[2157] Fix | Delete
* Bail out if it does not exist, is not approved, or its
[2158] Fix | Delete
* `comment_post_ID` does not match the given post ID.
[2159] Fix | Delete
*/
[2160] Fix | Delete
$comment = get_comment( $reply_to_id );
[2161] Fix | Delete
[2162] Fix | Delete
if (
[2163] Fix | Delete
! $comment instanceof WP_Comment ||
[2164] Fix | Delete
0 === (int) $comment->comment_approved ||
[2165] Fix | Delete
$post->ID !== (int) $comment->comment_post_ID
[2166] Fix | Delete
) {
[2167] Fix | Delete
return 0;
[2168] Fix | Delete
}
[2169] Fix | Delete
[2170] Fix | Delete
return $reply_to_id;
[2171] Fix | Delete
}
[2172] Fix | Delete
[2173] Fix | Delete
/**
[2174] Fix | Delete
* Displays a list of comments.
[2175] Fix | Delete
*
[2176] Fix | Delete
* Used in the comments.php template to list comments for a particular post.
[2177] Fix | Delete
*
[2178] Fix | Delete
* @since 2.7.0
[2179] Fix | Delete
*
[2180] Fix | Delete
* @see WP_Query::$comments
[2181] Fix | Delete
*
[2182] Fix | Delete
* @global WP_Query $wp_query WordPress Query object.
[2183] Fix | Delete
* @global int $comment_alt
[2184] Fix | Delete
* @global int $comment_depth
[2185] Fix | Delete
* @global int $comment_thread_alt
[2186] Fix | Delete
* @global bool $overridden_cpage
[2187] Fix | Delete
* @global bool $in_comment_loop
[2188] Fix | Delete
*
[2189] Fix | Delete
* @param string|array $args {
[2190] Fix | Delete
* Optional. Formatting options.
[2191] Fix | Delete
*
[2192] Fix | Delete
* @type object $walker Instance of a Walker class to list comments. Default null.
[2193] Fix | Delete
* @type int $max_depth The maximum comments depth. Default empty.
[2194] Fix | Delete
* @type string $style The style of list ordering. Accepts 'ul', 'ol', or 'div'.
[2195] Fix | Delete
* 'div' will result in no additional list markup. Default 'ul'.
[2196] Fix | Delete
* @type callable $callback Callback function to use. Default null.
[2197] Fix | Delete
* @type callable $end-callback Callback function to use at the end. Default null.
[2198] Fix | Delete
* @type string $type Type of comments to list. Accepts 'all', 'comment',
[2199] Fix | Delete
* 'pingback', 'trackback', 'pings'. Default 'all'.
[2200] Fix | Delete
* @type int $page Page ID to list comments for. Default empty.
[2201] Fix | Delete
* @type int $per_page Number of comments to list per page. Default empty.
[2202] Fix | Delete
* @type int $avatar_size Height and width dimensions of the avatar size. Default 32.
[2203] Fix | Delete
* @type bool $reverse_top_level Ordering of the listed comments. If true, will display
[2204] Fix | Delete
* newest comments first. Default null.
[2205] Fix | Delete
* @type bool $reverse_children Whether to reverse child comments in the list. Default null.
[2206] Fix | Delete
* @type string $format How to format the comments list. Accepts 'html5', 'xhtml'.
[2207] Fix | Delete
* Default 'html5' if the theme supports it.
[2208] Fix | Delete
* @type bool $short_ping Whether to output short pings. Default false.
[2209] Fix | Delete
* @type bool $echo Whether to echo the output or return it. Default true.
[2210] Fix | Delete
* }
[2211] Fix | Delete
* @param WP_Comment[] $comments Optional. Array of WP_Comment objects. Default null.
[2212] Fix | Delete
* @return void|string Void if 'echo' argument is true, or no comments to list.
[2213] Fix | Delete
* Otherwise, HTML list of comments.
[2214] Fix | Delete
*/
[2215] Fix | Delete
function wp_list_comments( $args = array(), $comments = null ) {
[2216] Fix | Delete
global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop;
[2217] Fix | Delete
[2218] Fix | Delete
$in_comment_loop = true;
[2219] Fix | Delete
[2220] Fix | Delete
$comment_alt = 0;
[2221] Fix | Delete
$comment_thread_alt = 0;
[2222] Fix | Delete
$comment_depth = 1;
[2223] Fix | Delete
[2224] Fix | Delete
$defaults = array(
[2225] Fix | Delete
'walker' => null,
[2226] Fix | Delete
'max_depth' => '',
[2227] Fix | Delete
'style' => 'ul',
[2228] Fix | Delete
'callback' => null,
[2229] Fix | Delete
'end-callback' => null,
[2230] Fix | Delete
'type' => 'all',
[2231] Fix | Delete
'page' => '',
[2232] Fix | Delete
'per_page' => '',
[2233] Fix | Delete
'avatar_size' => 32,
[2234] Fix | Delete
'reverse_top_level' => null,
[2235] Fix | Delete
'reverse_children' => '',
[2236] Fix | Delete
'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml',
[2237] Fix | Delete
'short_ping' => false,
[2238] Fix | Delete
'echo' => true,
[2239] Fix | Delete
);
[2240] Fix | Delete
[2241] Fix | Delete
$parsed_args = wp_parse_args( $args, $defaults );
[2242] Fix | Delete
[2243] Fix | Delete
/**
[2244] Fix | Delete
* Filters the arguments used in retrieving the comment list.
[2245] Fix | Delete
*
[2246] Fix | Delete
* @since 4.0.0
[2247] Fix | Delete
*
[2248] Fix | Delete
* @see wp_list_comments()
[2249] Fix | Delete
*
[2250] Fix | Delete
* @param array $parsed_args An array of arguments for displaying comments.
[2251] Fix | Delete
*/
[2252] Fix | Delete
$parsed_args = apply_filters( 'wp_list_comments_args', $parsed_args );
[2253] Fix | Delete
[2254] Fix | Delete
// Figure out what comments we'll be looping through ($_comments).
[2255] Fix | Delete
if ( null !== $comments ) {
[2256] Fix | Delete
$comments = (array) $comments;
[2257] Fix | Delete
if ( empty( $comments ) ) {
[2258] Fix | Delete
return;
[2259] Fix | Delete
}
[2260] Fix | Delete
if ( 'all' !== $parsed_args['type'] ) {
[2261] Fix | Delete
$comments_by_type = separate_comments( $comments );
[2262] Fix | Delete
if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) {
[2263] Fix | Delete
return;
[2264] Fix | Delete
}
[2265] Fix | Delete
$_comments = $comments_by_type[ $parsed_args['type'] ];
[2266] Fix | Delete
} else {
[2267] Fix | Delete
$_comments = $comments;
[2268] Fix | Delete
}
[2269] Fix | Delete
} else {
[2270] Fix | Delete
/*
[2271] Fix | Delete
* If 'page' or 'per_page' has been passed, and does not match what's in $wp_query,
[2272] Fix | Delete
* perform a separate comment query and allow Walker_Comment to paginate.
[2273] Fix | Delete
*/
[2274] Fix | Delete
if ( $parsed_args['page'] || $parsed_args['per_page'] ) {
[2275] Fix | Delete
$current_cpage = get_query_var( 'cpage' );
[2276] Fix | Delete
if ( ! $current_cpage ) {
[2277] Fix | Delete
$current_cpage = 'newest' === get_option( 'default_comments_page' ) ? 1 : $wp_query->max_num_comment_pages;
[2278] Fix | Delete
}
[2279] Fix | Delete
[2280] Fix | Delete
$current_per_page = get_query_var( 'comments_per_page' );
[2281] Fix | Delete
if ( $parsed_args['page'] != $current_cpage || $parsed_args['per_page'] != $current_per_page ) {
[2282] Fix | Delete
$comment_args = array(
[2283] Fix | Delete
'post_id' => get_the_ID(),
[2284] Fix | Delete
'orderby' => 'comment_date_gmt',
[2285] Fix | Delete
'order' => 'ASC',
[2286] Fix | Delete
'status' => 'approve',
[2287] Fix | Delete
);
[2288] Fix | Delete
[2289] Fix | Delete
if ( is_user_logged_in() ) {
[2290] Fix | Delete
$comment_args['include_unapproved'] = array( get_current_user_id() );
[2291] Fix | Delete
} else {
[2292] Fix | Delete
$unapproved_email = wp_get_unapproved_comment_author_email();
[2293] Fix | Delete
[2294] Fix | Delete
if ( $unapproved_email ) {
[2295] Fix | Delete
$comment_args['include_unapproved'] = array( $unapproved_email );
[2296] Fix | Delete
}
[2297] Fix | Delete
}
[2298] Fix | Delete
[2299] Fix | Delete
$comments = get_comments( $comment_args );
[2300] Fix | Delete
[2301] Fix | Delete
if ( 'all' !== $parsed_args['type'] ) {
[2302] Fix | Delete
$comments_by_type = separate_comments( $comments );
[2303] Fix | Delete
if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) {
[2304] Fix | Delete
return;
[2305] Fix | Delete
}
[2306] Fix | Delete
[2307] Fix | Delete
$_comments = $comments_by_type[ $parsed_args['type'] ];
[2308] Fix | Delete
} else {
[2309] Fix | Delete
$_comments = $comments;
[2310] Fix | Delete
}
[2311] Fix | Delete
}
[2312] Fix | Delete
[2313] Fix | Delete
// Otherwise, fall back on the comments from `$wp_query->comments`.
[2314] Fix | Delete
} else {
[2315] Fix | Delete
if ( empty( $wp_query->comments ) ) {
[2316] Fix | Delete
return;
[2317] Fix | Delete
}
[2318] Fix | Delete
if ( 'all' !== $parsed_args['type'] ) {
[2319] Fix | Delete
if ( empty( $wp_query->comments_by_type ) ) {
[2320] Fix | Delete
$wp_query->comments_by_type = separate_comments( $wp_query->comments );
[2321] Fix | Delete
}
[2322] Fix | Delete
if ( empty( $wp_query->comments_by_type[ $parsed_args['type'] ] ) ) {
[2323] Fix | Delete
return;
[2324] Fix | Delete
}
[2325] Fix | Delete
$_comments = $wp_query->comments_by_type[ $parsed_args['type'] ];
[2326] Fix | Delete
} else {
[2327] Fix | Delete
$_comments = $wp_query->comments;
[2328] Fix | Delete
}
[2329] Fix | Delete
[2330] Fix | Delete
if ( $wp_query->max_num_comment_pages ) {
[2331] Fix | Delete
$default_comments_page = get_option( 'default_comments_page' );
[2332] Fix | Delete
$cpage = get_query_var( 'cpage' );
[2333] Fix | Delete
if ( 'newest' === $default_comments_page ) {
[2334] Fix | Delete
$parsed_args['cpage'] = $cpage;
[2335] Fix | Delete
[2336] Fix | Delete
/*
[2337] Fix | Delete
* When first page shows oldest comments, post permalink is the same as
[2338] Fix | Delete
* the comment permalink.
[2339] Fix | Delete
*/
[2340] Fix | Delete
} elseif ( 1 == $cpage ) {
[2341] Fix | Delete
$parsed_args['cpage'] = '';
[2342] Fix | Delete
} else {
[2343] Fix | Delete
$parsed_args['cpage'] = $cpage;
[2344] Fix | Delete
}
[2345] Fix | Delete
[2346] Fix | Delete
$parsed_args['page'] = 0;
[2347] Fix | Delete
$parsed_args['per_page'] = 0;
[2348] Fix | Delete
}
[2349] Fix | Delete
}
[2350] Fix | Delete
}
[2351] Fix | Delete
[2352] Fix | Delete
if ( '' === $parsed_args['per_page'] && get_option( 'page_comments' ) ) {
[2353] Fix | Delete
$parsed_args['per_page'] = get_query_var( 'comments_per_page' );
[2354] Fix | Delete
}
[2355] Fix | Delete
[2356] Fix | Delete
if ( empty( $parsed_args['per_page'] ) ) {
[2357] Fix | Delete
$parsed_args['per_page'] = 0;
[2358] Fix | Delete
$parsed_args['page'] = 0;
[2359] Fix | Delete
}
[2360] Fix | Delete
[2361] Fix | Delete
if ( '' === $parsed_args['max_depth'] ) {
[2362] Fix | Delete
if ( get_option( 'thread_comments' ) ) {
[2363] Fix | Delete
$parsed_args['max_depth'] = get_option( 'thread_comments_depth' );
[2364] Fix | Delete
} else {
[2365] Fix | Delete
$parsed_args['max_depth'] = -1;
[2366] Fix | Delete
}
[2367] Fix | Delete
}
[2368] Fix | Delete
[2369] Fix | Delete
if ( '' === $parsed_args['page'] ) {
[2370] Fix | Delete
if ( empty( $overridden_cpage ) ) {
[2371] Fix | Delete
$parsed_args['page'] = get_query_var( 'cpage' );
[2372] Fix | Delete
} else {
[2373] Fix | Delete
$threaded = ( -1 != $parsed_args['max_depth'] );
[2374] Fix | Delete
$parsed_args['page'] = ( 'newest' === get_option( 'default_comments_page' ) ) ? get_comment_pages_count( $_comments, $parsed_args['per_page'], $threaded ) : 1;
[2375] Fix | Delete
set_query_var( 'cpage', $parsed_args['page'] );
[2376] Fix | Delete
}
[2377] Fix | Delete
}
[2378] Fix | Delete
// Validation check.
[2379] Fix | Delete
$parsed_args['page'] = (int) $parsed_args['page'];
[2380] Fix | Delete
if ( 0 == $parsed_args['page'] && 0 != $parsed_args['per_page'] ) {
[2381] Fix | Delete
$parsed_args['page'] = 1;
[2382] Fix | Delete
}
[2383] Fix | Delete
[2384] Fix | Delete
if ( null === $parsed_args['reverse_top_level'] ) {
[2385] Fix | Delete
$parsed_args['reverse_top_level'] = ( 'desc' === get_option( 'comment_order' ) );
[2386] Fix | Delete
}
[2387] Fix | Delete
[2388] Fix | Delete
if ( empty( $parsed_args['walker'] ) ) {
[2389] Fix | Delete
$walker = new Walker_Comment();
[2390] Fix | Delete
} else {
[2391] Fix | Delete
$walker = $parsed_args['walker'];
[2392] Fix | Delete
}
[2393] Fix | Delete
[2394] Fix | Delete
$output = $walker->paged_walk( $_comments, $parsed_args['max_depth'], $parsed_args['page'], $parsed_args['per_page'], $parsed_args );
[2395] Fix | Delete
[2396] Fix | Delete
$in_comment_loop = false;
[2397] Fix | Delete
[2398] Fix | Delete
if ( $parsed_args['echo'] ) {
[2399] Fix | Delete
echo $output;
[2400] Fix | Delete
} else {
[2401] Fix | Delete
return $output;
[2402] Fix | Delete
}
[2403] Fix | Delete
}
[2404] Fix | Delete
[2405] Fix | Delete
/**
[2406] Fix | Delete
* Outputs a complete commenting form for use within a template.
[2407] Fix | Delete
*
[2408] Fix | Delete
* Most strings and form fields may be controlled through the `$args` array passed
[2409] Fix | Delete
* into the function, while you may also choose to use the {@see 'comment_form_default_fields'}
[2410] Fix | Delete
* filter to modify the array of default fields if you'd just like to add a new
[2411] Fix | Delete
* one or remove a single field. All fields are also individually passed through
[2412] Fix | Delete
* a filter of the {@see 'comment_form_field_$name'} where `$name` is the key used
[2413] Fix | Delete
* in the array of fields.
[2414] Fix | Delete
*
[2415] Fix | Delete
* @since 3.0.0
[2416] Fix | Delete
* @since 4.1.0 Introduced the 'class_submit' argument.
[2417] Fix | Delete
* @since 4.2.0 Introduced the 'submit_button' and 'submit_fields' arguments.
[2418] Fix | Delete
* @since 4.4.0 Introduced the 'class_form', 'title_reply_before', 'title_reply_after',
[2419] Fix | Delete
* 'cancel_reply_before', and 'cancel_reply_after' arguments.
[2420] Fix | Delete
* @since 4.5.0 The 'author', 'email', and 'url' form fields are limited to 245, 100,
[2421] Fix | Delete
* and 200 characters, respectively.
[2422] Fix | Delete
* @since 4.6.0 Introduced the 'action' argument.
[2423] Fix | Delete
* @since 4.9.6 Introduced the 'cookies' default comment field.
[2424] Fix | Delete
* @since 5.5.0 Introduced the 'class_container' argument.
[2425] Fix | Delete
*
[2426] Fix | Delete
* @param array $args {
[2427] Fix | Delete
* Optional. Default arguments and form fields to override.
[2428] Fix | Delete
*
[2429] Fix | Delete
* @type array $fields {
[2430] Fix | Delete
* Default comment fields, filterable by default via the {@see 'comment_form_default_fields'} hook.
[2431] Fix | Delete
*
[2432] Fix | Delete
* @type string $author Comment author field HTML.
[2433] Fix | Delete
* @type string $email Comment author email field HTML.
[2434] Fix | Delete
* @type string $url Comment author URL field HTML.
[2435] Fix | Delete
* @type string $cookies Comment cookie opt-in field HTML.
[2436] Fix | Delete
* }
[2437] Fix | Delete
* @type string $comment_field The comment textarea field HTML.
[2438] Fix | Delete
* @type string $must_log_in HTML element for a 'must be logged in to comment' message.
[2439] Fix | Delete
* @type string $logged_in_as The HTML for the 'logged in as [user]' message, the Edit profile link,
[2440] Fix | Delete
* and the Log out link.
[2441] Fix | Delete
* @type string $comment_notes_before HTML element for a message displayed before the comment fields
[2442] Fix | Delete
* if the user is not logged in.
[2443] Fix | Delete
* Default 'Your email address will not be published.'.
[2444] Fix | Delete
* @type string $comment_notes_after HTML element for a message displayed after the textarea field.
[2445] Fix | Delete
* @type string $action The comment form element action attribute. Default '/wp-comments-post.php'.
[2446] Fix | Delete
* @type string $id_form The comment form element id attribute. Default 'commentform'.
[2447] Fix | Delete
* @type string $id_submit The comment submit element id attribute. Default 'submit'.
[2448] Fix | Delete
* @type string $class_container The comment form container class attribute. Default 'comment-respond'.
[2449] Fix | Delete
* @type string $class_form The comment form element class attribute. Default 'comment-form'.
[2450] Fix | Delete
* @type string $class_submit The comment submit element class attribute. Default 'submit'.
[2451] Fix | Delete
* @type string $name_submit The comment submit element name attribute. Default 'submit'.
[2452] Fix | Delete
* @type string $title_reply The translatable 'reply' button label. Default 'Leave a Reply'.
[2453] Fix | Delete
* @type string $title_reply_to The translatable 'reply-to' button label. Default 'Leave a Reply to %s',
[2454] Fix | Delete
* where %s is the author of the comment being replied to.
[2455] Fix | Delete
* @type string $title_reply_before HTML displayed before the comment form title.
[2456] Fix | Delete
* Default: '<h3 id="reply-title" class="comment-reply-title">'.
[2457] Fix | Delete
* @type string $title_reply_after HTML displayed after the comment form title.
[2458] Fix | Delete
* Default: '</h3>'.
[2459] Fix | Delete
* @type string $cancel_reply_before HTML displayed before the cancel reply link.
[2460] Fix | Delete
* @type string $cancel_reply_after HTML displayed after the cancel reply link.
[2461] Fix | Delete
* @type string $cancel_reply_link The translatable 'cancel reply' button label. Default 'Cancel reply'.
[2462] Fix | Delete
* @type string $label_submit The translatable 'submit' button label. Default 'Post a comment'.
[2463] Fix | Delete
* @type string $submit_button HTML format for the Submit button.
[2464] Fix | Delete
* Default: '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />'.
[2465] Fix | Delete
* @type string $submit_field HTML format for the markup surrounding the Submit button and comment hidden
[2466] Fix | Delete
* fields. Default: '<p class="form-submit">%1$s %2$s</p>', where %1$s is the
[2467] Fix | Delete
* submit button markup and %2$s is the comment hidden fields.
[2468] Fix | Delete
* @type string $format The comment form format. Default 'xhtml'. Accepts 'xhtml', 'html5'.
[2469] Fix | Delete
* }
[2470] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or WP_Post object to generate the form for. Default current post.
[2471] Fix | Delete
*/
[2472] Fix | Delete
function comment_form( $args = array(), $post = null ) {
[2473] Fix | Delete
$post = get_post( $post );
[2474] Fix | Delete
[2475] Fix | Delete
// Exit the function if the post is invalid or comments are closed.
[2476] Fix | Delete
if ( ! $post || ! comments_open( $post ) ) {
[2477] Fix | Delete
/**
[2478] Fix | Delete
* Fires after the comment form if comments are closed.
[2479] Fix | Delete
*
[2480] Fix | Delete
* For backward compatibility, this action also fires if comment_form()
[2481] Fix | Delete
* is called with an invalid post object or ID.
[2482] Fix | Delete
*
[2483] Fix | Delete
* @since 3.0.0
[2484] Fix | Delete
*/
[2485] Fix | Delete
do_action( 'comment_form_comments_closed' );
[2486] Fix | Delete
[2487] Fix | Delete
return;
[2488] Fix | Delete
}
[2489] Fix | Delete
[2490] Fix | Delete
$post_id = $post->ID;
[2491] Fix | Delete
$commenter = wp_get_current_commenter();
[2492] Fix | Delete
$user = wp_get_current_user();
[2493] Fix | Delete
$user_identity = $user->exists() ? $user->display_name : '';
[2494] Fix | Delete
[2495] Fix | Delete
$args = wp_parse_args( $args );
[2496] Fix | Delete
if ( ! isset( $args['format'] ) ) {
[2497] Fix | Delete
$args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml';
[2498] Fix | Delete
}
[2499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function