Changeset 3416861
- Timestamp:
- 12/10/2025 10:48:04 PM (4 months ago)
- Location:
- post-formats-for-block-themes/trunk
- Files:
-
- 2 edited
-
post-formats-for-block-themes.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
post-formats-for-block-themes/trunk/post-formats-for-block-themes.php
r3413728 r3416861 4 4 * Plugin URI: https://wordpress.org/plugins/post-formats-for-block-themes/ 5 5 * Description: Modernizes WordPress post formats for block themes with format-specific patterns, auto-detection, and enhanced editor experience. 6 * Version: 1.1. 06 * Version: 1.1.1 7 7 * Requires at least: 6.8 8 8 * Tested up to: 6.9 … … 39 39 * Plugin constants 40 40 */ 41 define( 'PFBT_VERSION', '1.1. 0' );41 define( 'PFBT_VERSION', '1.1.1' ); 42 42 define( 'PFBT_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 43 43 define( 'PFBT_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); … … 76 76 } 77 77 add_filter( 'default_template_types', 'pfbt_register_template_types_early', 1 ); 78 79 /** 80 * Hide format templates from template chooser dropdown 81 * 82 * Format templates should apply automatically via template hierarchy, 83 * not appear as selectable options in the Template dropdown. 84 * This prevents them from hiding/replacing the theme's templates. 85 * 86 * @since 1.0.4 87 * @param array $query_result Array of block template objects 88 * @param array $query Block templates query parameters 89 * @param string $template_type wp_template or wp_template_part 90 * @return array Filtered array of block templates 91 */ 92 function pfbt_filter_format_templates_from_chooser( $query_result, $query, $template_type ) { 93 // Only filter templates (not template parts) in the post editor 94 if ( 'wp_template' !== $template_type ) { 95 return $query_result; 96 } 97 98 // Don't filter if we're in the site editor or template admin 99 if ( is_admin() && isset( $_GET['page'] ) && 'gutenberg-edit-site' === $_GET['page'] ) { 100 return $query_result; 101 } 102 103 // Filter out format templates from the chooser 104 $format_template_slugs = array( 105 'single-format-aside', 106 'single-format-gallery', 107 'single-format-link', 108 'single-format-image', 109 'single-format-quote', 110 'single-format-status', 111 'single-format-video', 112 'single-format-audio', 113 'single-format-chat', 114 ); 115 116 return array_filter( 117 $query_result, 118 function( $template ) use ( $format_template_slugs ) { 119 return ! in_array( $template->slug, $format_template_slugs, true ); 120 } 121 ); 122 } 123 add_filter( 'get_block_templates', 'pfbt_filter_format_templates_from_chooser', 10, 3 ); 78 124 79 125 /** -
post-formats-for-block-themes/trunk/readme.txt
r3413728 r3416861 6 6 Tested up to: 6.9 7 7 Requires PHP: 7.4 8 Stable tag: 1.1. 08 Stable tag: 1.1.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 347 347 348 348 == Changelog == 349 350 = 1.1.1 - 2025-12-09 = 351 352 **Bug Fixes** 353 354 * **Fixed:** Critical issue where format templates (Chat Format, Gallery Format, etc.) were appearing in the Template dropdown and hiding/replacing theme templates. Format templates now apply automatically via template hierarchy but don't show as selectable options in the editor. 349 355 350 356 = 1.1.0 - 2025-12-08 =
Note: See TracChangeset
for help on using the changeset viewer.