Add checks for WP_Error. props ptahdunbar. see #14746

git-svn-id: https://develop.svn.wordpress.org/trunk@16315 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2010-11-12 04:10:56 +00:00
parent 647422ad33
commit d3684a509d
2 changed files with 15 additions and 5 deletions
+12 -4
View File
@@ -327,8 +327,12 @@ function get_post_class( $class = '', $post_id = null ) {
$classes[] = $post->post_type;
$classes[] = 'type-' . $post->post_type;
$classes[] = 'status-' . $post->post_status;
if ( get_post_format( $post->ID ) )
$classes[] = 'format-' . sanitize_html_class( get_post_format( $post->ID ) );
// Post Format
$post_format = get_post_format( $post->ID );
if ( $post_format && !is_wp_error($post_format) )
$classes[] = 'format-' . sanitize_html_class( $post_format );
else
$classes[] = 'format-default';
@@ -424,8 +428,12 @@ function get_body_class( $class = '' ) {
$classes[] = 'single';
$classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
$classes[] = 'postid-' . $post_id;
if ( get_post_format( $post_id ) )
$classes[] = 'single-format-' . sanitize_html_class( get_post_format( $post_id ) );
// Post Format
$post_format = get_post_format( $post->ID );
if ( $post_format && !is_wp_error($post_format) )
$classes[] = 'single-format-' . sanitize_html_class( $post_format );
else
$classes[] = 'single-format-default';