From 74d6b6e1f3041d6f6e49637f99153cf200d7b675 Mon Sep 17 00:00:00 2001 From: raduconst Date: Wed, 27 Mar 2019 10:04:02 +0200 Subject: [PATCH] Added back the Toggle Post Details option to the Story Budget page --- modules/story-budget/story-budget.php | 30 ++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/modules/story-budget/story-budget.php b/modules/story-budget/story-budget.php index 29b523b2d..a2388a2ef 100644 --- a/modules/story-budget/story-budget.php +++ b/modules/story-budget/story-budget.php @@ -471,7 +471,11 @@ function print_post( $post, $parent_term ) { ?> term_columns as $key => $name ) { - echo ''; + if ( $key === 'title' ) { + echo ''; + } else { + echo ''; + } if ( method_exists( $this, 'term_column_' . $key ) ) { $method = 'term_column_' . $key; echo $this->$method( $post, $parent_term ); @@ -533,14 +537,30 @@ function term_column_default( $post, $column_name, $parent_term ) { */ function term_column_title( $post, $parent_term ) { $post_title = _draft_or_post_title( $post->ID ); - + $post_type_object = get_post_type_object( $post->post_type ); $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID ); if ( $can_edit_post ) - $output = '' . esc_html( $post_title ) . ''; + $output = '' . esc_html( $post_title ) . ''; else $output = '' . esc_html( $post_title ) . ''; - + + /* + * the setup_postadata is still not fixed so the_excerpt cannot be used + * and the logic of get_the_excerpt function is replicated + */ + if ( current_user_can( 'read_post', $post->ID ) ) { + if ( post_password_required( $post ) ) { + $output .= '

' . __( 'There is no excerpt because this is a protected post.', 'edit-flow' ) . '

'; + } elseif ( $post->post_excerpt ) { + $output .= '

' . wp_trim_excerpt( $post->post_excerpt ) . '

'; + } else { + $excerpt_length = apply_filters( 'excerpt_length', 15 ); + $excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' ); + $output .= '

' . wp_trim_words( $post->post_content, $excerpt_length, $excerpt_more ) . '

'; + } + } + // Edit or Trash or View $output .= '
'; $item_actions = array(); @@ -629,7 +649,7 @@ function table_navigation() {