Make WordPress Core

Changeset 42966


Ignore:
Timestamp:
04/10/2018 04:11:55 PM (6 years ago)
Author:
adamsilverstein
Message:

Revisions: improve show_split_view=false support for title.

  • When show_split_view argument false, show title changes in a single column and only show title once if title is unchanged.

Props johnbillion, mbelchev.
Fixes #42402.  

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/revision.php

    r42875 r42966  
    112112            // No, you didn't see this.
    113113            $diff  = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>';
    114             $diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td><td></td><td>' . esc_html( $compare_to->post_title ) . '</td>';
    115             $diff .= '</tr></tbody>';
     114
     115            // In split screen mode, show the title before/after side by side.
     116            if ( true === $args['show_split_view'] ) {
     117                $diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td><td></td><td>' . esc_html( $compare_to->post_title ) . '</td>';
     118            } else {
     119                $diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td>';
     120
     121                // In single column mode, only show the title once if unchanged.
     122                if ( $compare_from->post_title !== $compare_to->post_title ) {
     123                    $diff .= '</tr><tr><td>' . esc_html( $compare_to->post_title ) . '</td>';
     124                }
     125            }
     126
     127            $diff .= '</tr></tbody>';
    116128            $diff .= '</table>';
    117129        }
Note: See TracChangeset for help on using the changeset viewer.