Make WordPress Themes

Changeset 284142


Ignore:
Timestamp:
08/15/2025 07:43:19 PM (7 months ago)
Author:
extendify
Message:

Release version 2.0.28

Location:
extendable/2.0.28
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • extendable/2.0.28/functions.php

    r278051 r284142  
    261261
    262262/**
    263  * Force the block editor to use page-with-title
    264  * as the default template for new Pages.
     263 * Set default template for new pages in the block editor (auto-drafts)
    265264 *
    266265 * @since Extendable 2.0.26
    267266 * @return void
    268267 */
    269 function extendable_set_default_template_for_new_pages( WP_REST_Response $response, WP_Post $post ) {
    270    
     268function extendable_set_default_template_for_auto_drafts( WP_REST_Response $response, WP_Post $post ) {
     269
    271270    if ( 'page' !== $post->post_type ) {
    272271        return $response;
     
    287286    return $response;
    288287}
    289 add_filter( 'rest_prepare_page', 'extendable_set_default_template_for_new_pages', 10, 2 );
     288add_filter( 'rest_prepare_page', 'extendable_set_default_template_for_auto_drafts', 10, 2 );
     289 
     290/**
     291 * Set default template for new pages when saved/published
     292 *
     293 * @since Extendable 2.0.28
     294 * @param int     $post_id Post ID.
     295 * @param WP_Post $post    Post object.
     296 * @param bool    $update  Whether this is an existing post being updated.
     297 * @return void
     298 */
     299function extendable_set_default_template_for_new_pages( $post_id, $post, $update ) {
     300
     301    if ( 'page' !== $post->post_type ) {
     302        return;
     303    }
     304
     305    if ( $update ) {
     306        return;
     307    }
     308
     309    if ( 'revision' === $post->post_status ) {
     310        return;
     311    }
     312
     313    $current_template = get_page_template_slug( $post_id );
     314   
     315    // If no template is set or it's the default template, set our default
     316    if ( empty( $current_template ) || 'page' === $current_template ) {
     317        update_post_meta( $post_id, '_wp_page_template', 'page-with-title' );
     318    }
     319}
     320add_action( 'wp_insert_post', 'extendable_set_default_template_for_new_pages', 10, 3 );
  • extendable/2.0.28/readme.txt

    r282557 r284142  
    44Tested up to: 6.8
    55Requires PHP: 7.4
    6 Stable tag: 2.0.27
     6Stable tag: 2.0.28
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313
    1414== Changelog ==
     15
     16= 2.0.28 - 2025-08-16 =
     17- Fix: Default page template now properly persists when publishing pages
    1518
    1619= 2.0.27 - 2025-08-06 =
  • extendable/2.0.28/style.css

    r282557 r284142  
    88Tested up to: 6.8
    99Requires PHP: 7.4
    10 Version: 2.0.27
     10Version: 2.0.28
    1111License: GNU General Public License v2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.