Make WordPress Core

Changeset 58687

Timestamp:
07/08/2024 10:43:22 AM (4 weeks ago)
Author:
karmatosed
Message:

Twenty Seventeen: Fixes front page panels allow pages of any status to be shown.

If you have a published page set to a section but also private, draft, pending or trash at some point in the future it was still showing on the homepage. There was no clarity to the user what was happening. This adds in a check to the post_status variable before displaying panel content and adjusts the customizer to show a placeholder if the page is draft,trashed,deleted.

Props brettshumaker, sabernhardt.
Fixes #46604.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/inc/template-tags.php

    r56352 r58687  
    150150    }
    151151
     152
     153
     154
    152155    global $post; // Modify the global post object before setting up post data.
    153156    if ( get_theme_mod( 'panel_' . $id ) ) {
     
    156159        set_query_var( 'panel', $id );
    157160
    158         get_template_part( 'template-parts/page/content', 'front-page-panels' );
     161        if ( $post && in_array( $post->post_status, array( 'publish', 'private' ), true ) ) {
     162            get_template_part( 'template-parts/page/content', 'front-page-panels' );
     163        } elseif ( is_customize_preview() ) {
     164            $show_panel_placeholder = true;
     165        }
    159166
    160167        wp_reset_postdata();
    161168    } elseif ( is_customize_preview() ) {
     169
     170
     171
     172
    162173        // The output placeholder anchor.
    163174        printf(
Note: See TracChangeset for help on using the changeset viewer.