Skip to content

Instantly share code, notes, and snippets.

@CNDLS
CNDLS / elementor-overrides.scss
Created March 19, 2018 20:42
Stylesheet that overrides Elementor default styles to work with Bootstrap 4 grid system.
// Overrides of the CSS included with the Elementor plugin
// These overrides make the Elementor container and row and column structure
// conform more to the Bootstrap 4 grid model.
// Using mixins from scss/vendor/bootstrap/mixins/_grid.scss.
// Container
.elementor-section.elementor-section-boxed>.elementor-container,
.elementor-section .elementor-container {
@include make-container();
@include make-container-max-widths($max-widths: $container-max-widths, $breakpoints: $grid-breakpoints);
@CNDLS
CNDLS / filter-elementor-backbone-template.php
Created March 19, 2018 20:37
Filter the Backbone.js template for Elementor Section and Column elements, so that editing the custom spacing controls shows up in the page editor preview pane.
<?php
/*
* Change the Editor Preview Template for the section and column elements so that each
* element's mld spacing settings are reflected in the preview window whenever the user makes a
* change.
*/
add_action( 'elementor/element/print_template', 'add_spacing_to_section_and_column_preview_template', 10, 2);
/**
*
@CNDLS
CNDLS / before-render-column-or-section.php
Created March 19, 2018 20:22
Apply the custom spacing controls to the PHP rendering of the Elementor Section or Column.
<?php
/*
* Utilities - helper functions for Elementor customization.
*/
/**
* Generate spacing classes for an element given an array of spacing items.
* @param $spacing_items Array
* @return Array An array where each element is a spacing class.
*/
@CNDLS
CNDLS / elementor-section-column-spacing-controls.php
Last active May 25, 2022 11:31
Add custom spacing controls to Elementor's Section and Column elements.
<?php
/*
* Add custom spacing (margin and padding) controls to Elementor's Column_Element and Section_Element
* This hook means "run this function before you add the control section named 'section_advanced' on
* the element 'column' or 'section'.
*/
add_action( 'elementor/element/column/section_advanced/before_section_start', 'add_custom_spacing_controls' );
add_action( 'elementor/element/section/section_advanced/before_section_start', 'add_custom_spacing_controls' );
/**
@CNDLS
CNDLS / elementor-customization-init.php
Last active February 5, 2020 16:53
Register custom widget class definition files and custom widget category.
<?php
// Load the theme's custom Widgets so that they appear in the Elementor element panel.
add_action( 'elementor/widgets/widgets_registered', 'register_elementor_widgets' );
function register_elementor_widgets() {
// We check if the Elementor plugin has been installed / activated.
if ( defined( 'ELEMENTOR_PATH' ) && class_exists('Elementor\Widget_Base') ) {
require_once( get_template_directory() . '/widgets/course-box.php' );
require_once( get_template_directory() . '/widgets/h2-content.php' );
require_once( get_template_directory() . '/widgets/h3-content.php' );
@CNDLS
CNDLS / schedule-widget-template.php
Created March 19, 2018 18:36
Shows the PHP template file for a custom Elementor widget.
<div class="schedule">
<div class="schedule__inner">
<h3 class="schedule__heading"><?php echo $sample_schedule['title']; ?></h3>
<table class="schedule__table">
<thead class="schedule__table-header">
<tr class="schedule__table-header-row">
<?php foreach ( $sample_schedule['column_headings'] as $column_index => $heading ) : ?>
<?php
$column_visibility_classes = '';
if ( $column_index === 2 ) {
@CNDLS
CNDLS / custom-elementor-widget.php
Last active October 20, 2022 11:35
Shows how to override the Widget_Base class to create a custom widget that can be used in the Elementor page editor.
<?php
namespace Elementor; // Custom widgets must be defined in the Elementor namespace
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly (security measure)
class Schedule extends Widget_Base { // Extend ELementor's Widget_Base class
// Machine name or "handle" for the widget
public function get_name() {
return __( 'schedule', 'mld' );
@CNDLS
CNDLS / gist:a7287d993996e9a63322
Created February 4, 2016 20:32
responsive font-sizing
font-size: calc((1vw + 1.5vh)/2);
@CNDLS
CNDLS / TextMate_2014-04-28-094311_aptop.hang
Created April 28, 2014 14:41
TextMate Hang preceded by text-coloring fail
Date/Time: 2014-04-28 09:43:02 -0400
OS Version: 10.9.2 (Build 13C1021)
Architecture: x86_64
Report Version: 18
Command: TextMate
Path: /Applications/TextMate 2.app/Contents/MacOS/TextMate
Version: 2.0-alpha.9529 (9529)
Parent: launchd [289]