summaryrefslogtreecommitdiffstats
path: root/wp-includes/comment-template.php
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/comment-template.php')
-rw-r--r--wp-includes/comment-template.php23
1 files changed, 11 insertions, 12 deletions
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index a1005d5..d125f0c 100644
--- a/wp-includes/comment-template.php
+++ b/wp-includes/comment-template.php
@@ -1390,22 +1390,24 @@ function wp_comment_form_unfiltered_html_nonce() {
*
* @since 1.5.0
*
- * @global WP_Query $wp_query WordPress Query object.
- * @global WP_Post $post Global post object.
- * @global wpdb $wpdb WordPress database abstraction object.
+ * @global WP_Query $wp_query WordPress Query object.
+ * @global WP_Post $post Global post object.
+ * @global wpdb $wpdb WordPress database abstraction object.
* @global int $id
- * @global WP_Comment $comment Global comment object.
+ * @global WP_Comment $comment Global comment object.
* @global string $user_login
* @global string $user_identity
* @global bool $overridden_cpage
* @global bool $withcomments
+ * @global string $wp_stylesheet_path Path to current theme's stylesheet directory.
+ * @global string $wp_template_path Path to current theme's template directory.
*
* @param string $file Optional. The file to load. Default '/comments.php'.
* @param bool $separate_comments Optional. Whether to separate the comments by comment type.
* Default false.
*/
function comments_template( $file = '/comments.php', $separate_comments = false ) {
- global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_identity, $overridden_cpage;
+ global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_identity, $overridden_cpage, $wp_stylesheet_path, $wp_template_path;
if ( ! ( is_single() || is_page() || $withcomments ) || empty( $post ) ) {
return;
@@ -1515,7 +1517,7 @@ function comments_template( $file = '/comments.php', $separate_comments = false
$top_level_count = $top_level_query->query( $top_level_args );
- $comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page;
+ $comment_args['offset'] = ( (int) ceil( $top_level_count / $per_page ) - 1 ) * $per_page;
}
}
@@ -1600,10 +1602,7 @@ function comments_template( $file = '/comments.php', $separate_comments = false
define( 'COMMENTS_TEMPLATE', true );
}
- $stylesheet_path = get_stylesheet_directory();
- $template_path = get_template_directory();
-
- $theme_template = $stylesheet_path . $file;
+ $theme_template = trailingslashit( $wp_stylesheet_path ) . $file;
/**
* Filters the path to the theme template file used for the comments template.
@@ -1616,8 +1615,8 @@ function comments_template( $file = '/comments.php', $separate_comments = false
if ( file_exists( $include ) ) {
require $include;
- } elseif ( file_exists( $template_path . $file ) ) {
- require $template_path . $file;
+ } elseif ( file_exists( trailingslashit( $wp_template_path ) . $file ) ) {
+ require trailingslashit( $wp_template_path ) . $file;
} else { // Backward compat code will be removed in a future release.
require ABSPATH . WPINC . '/theme-compat/comments.php';
}