View wp-block-locking-toggling-filter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
\add_filter('block_editor_settings_all', static function (array $settings): array { | |
$currentUserRoles = \wp_get_current_user()->roles; | |
$allowedUserRoles = ['editor', 'administrator']; | |
$isUserAllowed = (bool)\array_intersect($currentUserRoles, $allowedUserRoles); | |
if (!$isUserAllowed) { | |
$settings['canLockBlocks'] = false; | |
} |
View admin-notify.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function notify(string $message, string $noticeType, array $allowedMarkup = []): void | |
{ | |
$callback = function () use ($message, $noticeType, $allowedMarkup) { | |
?> | |
<div class="notice notice-<?= \sanitize_html_class($noticeType) ?>"> | |
<p><?= \wp_kses($message, $allowedMarkup) ?></p> | |
</div> | |
<?php | |
}; |
View insertArrayPos.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function arrayInsertInPos( | |
$needle, | |
array &$haystack, | |
$pos, | |
$preserve = false, | |
$recursive = false | |
): array { | |
$keys = array_filter( |
View reorder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Re Order Files | |
* | |
* @since ${SINCE} | |
* @access private | |
* | |
* @param array $list An array $_FILES like to re-order | |
* | |
* @return array The re-order array list |
View wpPostByName.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get post by name | |
* | |
* @since 2.0.0 | |
* | |
* @param string $name The name ( slug ) of the post to retrieve. | |
* @param string $post_type The post type. Optional. Default to 'post'. | |
* | |
* @return WP_Post The post object |
View wp-screen-reader-text.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin screen-reader-text { | |
& { | |
clip : rect(1px, 1px, 1px, 1px); | |
position : absolute !important; | |
height : 1px; | |
width : 1px; | |
overflow : hidden; | |
&:focus { |
View switch-upload-dir-path-url.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Switch Upload Dir & Url | |
* | |
* @since 1.0.0 | |
* | |
* @param string $file The file path. | |
* @param string $switch The reference to the string to replace. Allowed 'dir>url', 'url>dir'. | |
* | |
* @return string The file url |
View extraImageNameChoose.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add Extra Image sizes | |
* | |
* Add extra image size to chosen select | |
* | |
* @param array $list The list of the default wordpress image sizes | |
* @return array $list The filtered image sizes | |
*/ | |
add_filter( 'image_size_names_choose', function( $list ) { |