* Retrieve the ID of the current item in the WordPress Loop.
*
* @since 2.1.0
- * @uses $post
*
* @return int|bool The ID of the current item in the WordPress Loop. False if $post is not set.
*/
* @since 0.71
*
* @param string $more_link_text Optional. Content for when there is more text.
- * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false.
+ * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false.
*/
function the_content( $more_link_text = null, $strip_teaser = false) {
$content = get_the_content( $more_link_text, $strip_teaser );
* @since 0.71
*
* @param string $more_link_text Optional. Content for when there is more text.
- * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false.
+ * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false.
* @return string
*/
function get_the_content( $more_link_text = null, $strip_teaser = false ) {
}
}
- if ( $preview ) // preview fix for javascript bug with foreign languages
+ if ( $preview ) // Preview fix for JavaScript bug with foreign languages.
$output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output );
return $output;
}
/**
- * Preview fix for javascript bug with foreign languages
+ * Preview fix for JavaScript bug with foreign languages.
*
* @since 3.1.0
* @access private
}
if ( is_page_template() ) {
$classes[] = 'page-template';
- $classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', get_page_template_slug( $page_id ) ) );
+
+ $template_slug = get_page_template_slug( $page_id );
+ $template_parts = explode( '/', $template_slug );
+
+ foreach ( $template_parts as $part ) {
+ $classes[] = 'page-template-' . sanitize_html_class( str_replace( array( '.', '/' ), '-', basename( $part, '.php' ) ) );
+ }
+ $classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', $template_slug ) );
} else {
$classes[] = 'page-template-default';
}
* @param string|array $args {
* Optional. Array or string of default arguments.
*
- * @type string $before HTML or text to prepend to each link. Default is '<p> Pages:'.
- * @type string $after HTML or text to append to each link. Default is '</p>'.
- * @type string $link_before HTML or text to prepend to each link, inside the <a> tag.
+ * @type string $before HTML or text to prepend to each link. Default is `<p> Pages:`.
+ * @type string $after HTML or text to append to each link. Default is `</p>`.
+ * @type string $link_before HTML or text to prepend to each link, inside the `<a>` tag.
* Also prepended to the current item, which is not linked. Default empty.
- * @type string $link_after HTML or text to append to each Pages link inside the <a> tag.
+ * @type string $link_after HTML or text to append to each Pages link inside the `<a>` tag.
* Also appended to the current item, which is not linked. Default empty.
* @type string $next_or_number Indicates whether page numbers should be used. Valid values are number
* and next. Default is 'number'.
* @param int $i Page number for paginated posts' page links.
*/
$link = apply_filters( 'wp_link_pages_link', $link, $i );
- $output .= $r['separator'] . $link;
+
+ // Use the custom links separator beginning with the second link.
+ $output .= ( 1 === $i ) ? ' ' : $r['separator'];
+ $output .= $link;
}
$output .= $r['after'];
} elseif ( $more ) {
$link = _wp_link_page( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
/** This filter is documented in wp-includes/post-template.php */
- $link = apply_filters( 'wp_link_pages_link', $link, $prev );
- $output .= $r['separator'] . $link;
+ $output .= apply_filters( 'wp_link_pages_link', $link, $prev );
}
$next = $page + 1;
if ( $next <= $numpages ) {
+ if ( $prev ) {
+ $output .= $r['separator'];
+ }
$link = _wp_link_page( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
/** This filter is documented in wp-includes/post-template.php */
- $link = apply_filters( 'wp_link_pages_link', $link, $next );
- $output .= $r['separator'] . $link;
+ $output .= apply_filters( 'wp_link_pages_link', $link, $next );
}
$output .= $r['after'];
}
*
* @internal This will probably change at some point...
* @since 1.2.0
- * @uses apply_filters() Calls 'the_meta_key' on list item HTML content, with key and value as separate parameters.
*/
function the_meta() {
if ( $keys = get_post_custom_keys() ) {
if ( ! empty( $current_page ) ) {
$_current_page = get_post( $current_page );
- if ( in_array( $page->ID, $_current_page->ancestors ) ) {
+ if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) {
$css_class[] = 'current_page_ancestor';
}
if ( $page->ID == $current_page ) {
* @since 2.0.0
*
* @param int|WP_Post $id Optional. Post ID or post object.
- * @param bool $fullsize Optional, default is false. Whether to use full size.
- * @param bool $deprecated Deprecated. Not used.
- * @param bool $permalink Optional, default is false. Whether to include permalink.
+ * @param bool $fullsize Optional, default is false. Whether to use full size.
+ * @param bool $deprecated Deprecated. Not used.
+ * @param bool $permalink Optional, default is false. Whether to include permalink.
*/
function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
if ( !empty( $deprecated ) )
* Retrieve an attachment page link using an image or icon, if possible.
*
* @since 2.5.0
- * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function.
*
- * @param int|WP_Post $id Optional. Post ID or post object.
- * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string.
- * @param bool $permalink Optional, default is false. Whether to add permalink to image.
- * @param bool $icon Optional, default is false. Whether to include icon.
- * @param string|bool $text Optional, default is false. If string, then will be link text.
+ * @param int|WP_Post $id Optional. Post ID or post object.
+ * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string.
+ * @param bool $permalink Optional, default is false. Whether to add permalink to image.
+ * @param bool $icon Optional, default is false. Whether to include icon.
+ * @param string|bool $text Optional, default is false. If string, then will be link text.
+ * @param array|string $attr Optional. Array or string of attributes.
* @return string HTML content.
*/
-function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {
+function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {
$id = intval( $id );
$_post = get_post( $id );
if ( $permalink )
$url = get_attachment_link( $_post->ID );
- if ( $text )
+ if ( $text ) {
$link_text = $text;
- elseif ( $size && 'none' != $size )
- $link_text = wp_get_attachment_image( $id, $size, $icon );
- else
+ } elseif ( $size && 'none' != $size ) {
+ $link_text = wp_get_attachment_image( $id, $size, $icon, $attr );
+ } else {
$link_text = '';
+ }
if ( trim( $link_text ) == '' )
$link_text = $_post->post_title;
}
/**
- * Wrap attachment in <<p>> element before content.
+ * Wrap attachment in paragraph tag before content.
*
* @since 2.0.0
*
* specific to that template.
*
* @since 2.5.0
- * @uses $wp_query
*
* @param string $template The specific template name if specific matching is required.
* @return bool True on success, false on failure.
*
* @since 2.6.0
*
- * @uses date_i18n()
- *
* @param int|object $revision Revision ID or revision object.
* @param bool $link Optional, default is true. Link to revisions's page?
* @return string i18n formatted datetimestamp or localized 'Current Revision'.
*
* @since 3.6.0
*
- * @uses date_i18n()
- *
* @param int|object $revision Revision ID or revision object.
* @param bool $link Optional, default is true. Link to revisions's page?
* @return string gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
*
* @since 2.6.0
*
- * @uses wp_get_post_revisions()
- * @uses wp_post_revision_title_expanded()
- * @uses get_edit_post_link()
- * @uses get_the_author_meta()
- *
* @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
- * @param string $type 'all' (default), 'revision' or 'autosave'
+ * @param string $type 'all' (default), 'revision' or 'autosave'
* @return null
*/
function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {