Conditional visibility controls for all WordPress blocks.
GPL-2.0 License
Bot releases are hidden (Show)
Published by ndiego about 1 month ago
render_block
callback function to only fetch plugin settings if a block has visibility conditions set.get_file_data()
.Published by ndiego 3 months ago
PluginMoreMenuItem
slot usage to support unified slots in 6.6 and ensure backward compatibility.useCommand
import now that 6.4 is the minimum version.Published by ndiego 7 months ago
visibility_preset
post type.__experimentalGetSettings
function with the stable __getSettings
version.enqueue_block_assets
.Published by ndiego 9 months ago
Published by ndiego 10 months ago
Published by ndiego about 1 year ago
Published by ndiego about 1 year ago
This release is exactly the same as version 3.1.0, but was required to stay in line with the WordPress.org repo. Two folders were missing when the plugin was synced to the plugin repo. To fix the issue, the version had to be bumped to 3.1.1.
Published by ndiego about 1 year ago
getEntityRecord
(#77).hide_on_restricted_users
variable (#64).Published by ndiego over 1 year ago
Published by ndiego over 1 year ago
blockVisibility.contextualIndicatorClasses
filter to include more variables, which allows for more customization. Example usage below:/**
* Modifies the indicator classes based on active controls. In this
* case, add a class if the block has been hidden on medium screens.
*
* @param {string} classes - The original classes of the indicator.
* @param {Array} activeControls - The active controls.
* @param {object} controls - The controls object.
*
* @returns {string} - The modified classes of the indicator.
*/
function modifyIndicatorClasses( classes, activeControls, controls ) {
if ( activeControls.includes( 'screen-size' ) ) {
const screenSize = controls?.screenSize;
const hiddenOnMedium = screenSize?.hideOnScreenSize?.medium ?? false;
if ( hiddenOnMedium ) {
return classes + ' hidden-on-medium';
}
}
return classes;
}
wp.hooks.addFilter(
'blockVisibility.contextualIndicatorClasses',
'example-plugin/modify-indicator-classes',
modifyIndicatorClasses
);
Published by ndiego over 1 year ago
Published by ndiego over 1 year ago
Published by ndiego over 1 year ago
Read the Block Visibility 3.0.0 announcement post.
ControlSetControls-
and ControlSetControlsIntegrations-
slots for adding visibility control editor UI elements.PluginSettings
slot for adding additional plugin settings.VisibilityControls
, VisibilityControlsGeneral
, and VisibilityControlsIntegrations
slots for adding additional visibility control settings.blockVisibility.globallyRestrictedBlockTypes
and blockVisibility.widgetAreaRestrictedBlockTypes
filters to restrict visibility controls on specific block types.enqueue_block_editor_assets
, and previous workarounds have been removed.ControlSetControlsBottom-
slot, use ControlSetControlsIntegrations-
instead.VisibilityControlsIntegrationsBottom
slot, use VisibilityControlsIntegrations
instead.blockVisibility.addControlSetModals
and blockVisibility.addControlSetOptions
filters.ControlSetControlsTop-
and ControlSetControlsMiddle-
slots.PluginSettingsEditorTop
and PluginSettingsEditorTop
slots.PluginSettingsTop
, PluginSettingsMiddle
, and PluginSettingsBottom
slots.VisibilityControlsTop
, VisibilityControlsMiddle
, and VisibilityControlsBottom
slots.VisibilityControlsIntegrationsTop
and VisibilityControlsIntegrationsBottom
slots.RuleSetOptionsTop
, RuleSetOptionsMiddle
, RuleSetOptionsBottom
, and RuleSetMoreSettingsTools
slots.block_visibility_frontend_test_date_time_schedule
filter.VisibilityControlsDateTimeTop
and VisibilityControlsDateTimeBottom
slots.DateTimeScheduleToolbar-
and DateTimeScheduleControlsTop-
, and DateTimeScheduleControlsBottom-
slots.ScheduleOptionsTools
, ScheduleOptionsMiddle
, and ScheduleOptionsBottom
slots.ScreenSizeControls
slot.VisibilityByRoleControls
slot.Published by ndiego over 1 year ago
Published by ndiego over 1 year ago
Published by ndiego over 1 year ago
Published by ndiego almost 2 years ago
Published by ndiego almost 2 years ago
Block Visibility now requires WordPress 6.0+ with version 2.5.0 and users of the Pro add-on will need to upgrade to Pro 1.6.0 to take advantage of these latest enhancements. There have also been updates to the way visibility defaults work. Check out the release article for more information.
meow-gallery/gallery
block. Added better error handling to avoid a similar issue in other third-party blocks.Published by ndiego almost 2 years ago