Skip to content

Instantly share code, notes, and snippets.

@bainternet
bainternet / collapse_sections.php
Created June 16, 2019 15:05 — forked from SJ-James/collapse_sections.php
Add a 'Collapse Section' button to the Elementor Editor
<?php
//Add to functions.php in child theme
function e_collapse_sections(){
?>
<!-- Scripts and styles should enqueued properly but for the sake of having it all in one function...-->
<script>
if ( self !== top ) { // Check if we're in a preview window / iframe
jQuery(document).ready(function($){
@bainternet
bainternet / elementor-form-additional-webhook.php
Created March 14, 2019 09:32 — forked from csalzano/elementor-form-additional-webhook.php
Elementor Form additional webhook example
<?php
/**
* Plugin Name: Elementor Form Additional Webhook
* Plugin URI: https://coreysalzano.com/
* Description: Adds a second Webhook to the Lot Wizard trial signup form
* Version: 1.0.0
* Author: Corey Salzano
* Author URI: https://github.com/mistercorey
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@bainternet
bainternet / file.php
Created October 11, 2018 08:49
dd support for "Addify - Hide Product Price" to Elementor Price, and Add to Cart widgets
<?php
/**
* Add support for "Addify - Hide Product Price" to
* Elementor Price, and Add to Cart widgets
*/
add_filter( 'elementor/widget/render_content', function ( $widget_content, $widget ) {
global $product;
// Make sure its an add to cart or price widget
$widget_name = $widget->get_name();
if ( ! in_array( $widget_name, [ 'wc-add-to-cart', 'woocommerce-product-price' ] ) ) {
@bainternet
bainternet / GitHubIntegration.gs
Created October 11, 2018 06:53 — forked from ZachBray/GitHubIntegration.gs
Google Sheets GitHub Issue Integration
var paramsSheetName = "GitHub Params";
function createGitHubParams() {
var sheets = SpreadsheetApp.getActiveSpreadsheet();
var sheet = sheets.insertSheet(paramsSheetName);
sheet.appendRow(["API Token", "TODO"]);
sheet.appendRow(["Owner", "TODO"]);
sheet.appendRow(["Repository", "TODO"]);
}
@bainternet
bainternet / coundown-evergreen.php
Last active January 23, 2018 10:21 — forked from onnayokheng/coundown-evergreen.php
coundown-evergreen.php
<?php
namespace ElementorLandingPress\Widgets;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Typography;
use Elementor\Scheme_Color;
use Elementor\Scheme_Typography;
use Elementor\Utils;
use Elementor\Widget_Base;
@bainternet
bainternet / elementor-custom-templates.php
Created December 7, 2017 12:29 — forked from Tmeister/elementor-custom-templates.php
You can show *your* page templates in the predesigned templates area with screenshots
<?php
/**
* Elementor get the local templates via a CPT query and use a filter to let us change the template data
* https://github.com/pojome/elementor/blob/master/includes/template-library/sources/local.php#L202
* In ouy theme or plugin we can hook that filter as follow
*
* This filter change the source only for the *page* template type to show it in the main tab
* @see https://cl.ly/1z2Y1n2x0K0F
**/
@bainternet
bainternet / custom-functions.php
Created December 7, 2017 12:28 — forked from WPDevHQ/custom-functions.php
Keep accordion closed on page load
<?php // Leave this out if you already have an opening php tag in your file!
function elementor_accordion_title() { ?>
<script>
jQuery(document).ready(function() {
jQuery('.elementor-accordion-title').removeClass('active');
jQuery('.elementor-accordion-content').css('display', 'none');
});
</script>
<?php }
add_action( 'wp_footer', 'elementor_accordion_title' );
@bainternet
bainternet / file.php
Last active February 12, 2019 10:40 — forked from ryanlabelle/Elementor Add Control to Existing Widget
Elementor add control to existing widget
<?php
/* Add Image Stretch Option Control to the Image Gallery Widget */
add_action( 'elementor/element/before_section_end', function( $element, $section_id, $args ) {
/** @var \Elementor\Element_Base $element */
if ( 'image-gallery' === $element->get_name() && 'section_gallery' === $section_id ) {
$element->add_control(
'image_stretch',
[
'label' => __( 'Image Stretch', 'elementor' ),
<?php
// Elementor Class
if ( ! defined( 'ABSPATH' ) ) exit;
// This file is pretty much a boilerplate WordPress plugin.
// It does very little except including wp-widget.php
class ElementorRecentProduct {
private static $instance = null;
@bainternet
bainternet / code.php
Created December 7, 2017 12:24 — forked from dtbaker/code.php
Add a custom control to an existing Elementor widget
<?php
// This example will add a custom "select" drop down to the "Image Box"
// This will change the class="" on the rendered image box so we can style the Image Box differently
// based on the selected option from the editor.
// The class will be "my-image-box-style-blue" or "my-image-box-style-green" based on the selected option.
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) {
if( $section->get_name() == 'image-box' && $section_id == 'section_image' ){
// we are at the end of the "section_image" area of the "image-box"
$section->add_control(