05. Adding Devices to Control Stack

Now we have to add our custom devices to the default controls, so search for file named control-stack.php in following directory

elementor/includes/base/control-stack.php

A. Defining Device Constants

In this file check for the following function in line number 19 you will find following codes

control-stack.php
abstract class Controls_Stack {

	/**
	 * Responsive 'desktop' device name.
	 */
	const RESPONSIVE_DESKTOP = 'desktop';

	/**
	 * Responsive 'tablet' device name.
	 */
	const RESPONSIVE_TABLET = 'tablet';

	/**
	 * Responsive 'mobile' device name.
	 */
	const RESPONSIVE_MOBILE = 'mobile';

As you can see there are constant defined for each device so let's add ours too and te result will be as follows

circle-exclamation

B. Adding Defined Constants to control list functions

Check for following function in the same file more or less at line number 815

You can see line number 3 the $devices array variable, just add our defined constants in Step A here. So the resulted function will be as follows

circle-exclamation

Similarly now do the same thing in another function,check for following function in the same file more or less at line number 915

You can see line number 2 the $devices array variable, just add our defined constants in Step A here. So the resulted function will be as follows

circle-exclamation

Now save it and let's head to final step.

Files Attachment

In case you need more reference you can check the modified files i have included.

file-download
52KB

Last updated