google-site-verification=Ls9KcWrF2YZT7kMIaBSLGLUrYl--Png3qoN53OOo4WM Spectra - Display Conditions for Blocks - Spectra

No results found. Try again with different words?

Search must be at least 3 characters.

Spectra – Display Conditions for Blocks

Spectra has introduced the Display conditions feature for the blocks. The Display conditions are the options on which you would like to hide the block based on User State, User Role, Browser, and Operating System.

You can enable the Display conditions from the Spectra Admin Panel. Navigate to Settings > Spectra > Blocks > Display Conditions. Setting the toggle to on mode will enable the Display Conditions for blocks.

Once you enable the display conditions option, you can find the Display Conditions settings under the ‘Others’ section of the respective blocks.

Display condition option

Let’s see the options or conditions on which you can hide the block –

  • User State–Hide from Logged In, Logged out users.
  • Hide for User Role– None, Administrator, Editor, Author, Contributor, Subscriber, Customer, Shop Manager, Group Leader, LMS Manager, Instructor, Instructor’s Assistant, Student.
  • Hide on Browser–Internet Explorer, Mozilla Firefox, Google Chrome, Opera Mini, Opera, Safari, Microsoft Edge.
  • Hide on Operating System–iOS, Android, Windows, OpenBSD, SunOS, Linux, Mac OS.

How to disable Block Display Conditions for specific post types?

1) To disable the Block display conditions from all post types.

add_filter( \'enable_block_condition\', \'__return_false\' );

2) To disable the Block display conditions for Page post type.

add_filter( \'enable_block_condition\', function( $default = true) {
	if (isset($_REQUEST[\'post_type\']) && \'page\' === $_REQUEST[\'post_type\']) {
        return false;
    } elseif (isset($_GET[\'post\']) && \'page\' === get_post_type($_GET[\'post\'])) {
        return false;
    }
	return $default;
} );

3) To disable the Block display conditions for Post.

add_filter( \'enable_block_condition\', function( $default = true) {
    global $pagenow;
    if(in_array( $pagenow, array( \'post.php\', \'post-new.php\' ) )){
        if (isset($_REQUEST[\'post_type\']) && \'page\' === $_REQUEST[\'post_type\']) {
            return true;
        } elseif (isset($_GET[\'post\']) && \'page\' === get_post_type($_GET[\'post\'])) {
            return true;
        }
        return false;
    }

	return $default;
} );

Build Ultra High performance
Websites, Without Coding

Whether you are a beginner, marketer, or professional, Spectra has the
tools and resources you can rely on to succeed.

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.