Skip to content

Instantly share code, notes, and snippets.

View AlexGStapleton's full-sized avatar
🔥

Alex S AlexGStapleton

🔥
View GitHub Profile
@AlexGStapleton
AlexGStapleton / editor.php
Created April 1, 2025 13:14
SiteOrigin Widgets Bundle: Repeater Table Example Code with selectorArray usage
'frames' => array(
'type' => 'repeater',
'label' => __( 'Example', 'so-widgets-bundle' ),
'item_name' => __( 'item', 'so-widgets-bundle' ),
'item_label' => array(
'table' => true,
'selectorArray' => array(
array(
'selectorArray' => array(
array(
@AlexGStapleton
AlexGStapleton / script.js
Created September 22, 2024 11:43
SiteOrigin Widgets Bundle: Limit The Number of Total Opened Accordion Items Per Page
jQuery( function( $ ) {
const activeItems = [];
const $accordions = $( '.sow-accordion-panel-header' );
$accordions.on( 'click', function() {
const $$ = $( this );
// Is this script closing an accordion?
if ( $$.hasClass( 'sow-accordion-force-close' ) ) {
$$.removeClass( 'sow-accordion-force-close' );
@AlexGStapleton
AlexGStapleton / snippet.php
Last active July 2, 2024 01:04
SiteOrigin Blog Widget. Filter out non-top-level categories
<?php
add_filter( 'siteorigin_widgets_blog_filter_categories_output', function( $categories ) {
if ( empty( $categories ) ) {
return $categories;
}
return array_filter( $categories, function( $category ) {
return $category->parent === 0;
} );
}, 10, 1 );
@AlexGStapleton
AlexGStapleton / editor.php
Last active December 4, 2023 13:12
SiteOrigin Widgets Bundle: Repeater Table Example Code
'frames' => array(
'type' => 'repeater',
'label' => __( 'Example', 'so-widgets-bundle' ),
'item_name' => __( 'item', 'so-widgets-bundle' ),
'item_label' => array(
'table' => true,
'selectorArray' => array(
array(
'selector' => '.siteorigin-widget-field-title .siteorigin-widget-input',
'valueMethod' => 'val',
@AlexGStapleton
AlexGStapleton / gist:fa68ab34e5cabc16fb7e0e085cfad970
Created May 5, 2023 16:40
SiteOrigin Widgets Bundle Image Widget: Reset Custom Sizes if 9999px
add_filter( 'siteorigin_widgets_instance_sow-image', function( $instance, $widget ) {
if ( ! empty( $instance['size_width'] ) && $instance['size_width'] === 9999 ) {
unset( $instance['size_width'] );
}
if ( ! empty( $instance['size_height'] ) && $instance['size_height'] === 9999 ) {
unset( $instance['size_height'] );
}
if ( ! empty( $instance['size_external_width'] ) && $instance['size_external_width'] === 9999 ) {
@AlexGStapleton
AlexGStapleton / script.php
Created April 21, 2022 12:26
SO Video Player: Disable WP Video Player (MediaElement)
add_action( 'wp_enqueue_scripts', function() {
wp_deregister_script( 'wp-mediaelement' );
wp_deregister_style( 'wp-mediaelement' );
} );
add_filter( 'sow_video_add_controls', '__return_true' );
add_filter( 'sow_video_add_controls', '__return_true' );
@AlexGStapleton
AlexGStapleton / gist:2c4210cd765cec5329cf5a7c07ae8179
Last active November 16, 2021 17:07
SiteOrigin Page Builder: Output Row Class Containing Cell Count If More Than One Cell
add_filter( 'siteorigin_panels_row_classes', function( $row_classes, $row ) {
if ( ! empty( $row['cells'] ) && count( $row['cells'] ) > 1) {
$row_classes[] = 'panel-row-cells-' . count( $row['cells'] );
}
return $row_classes;
}, 10, 2 );
@AlexGStapleton
AlexGStapleton / gist:8cc7bd45265e3cc523b26c2cbb11c906
Created May 3, 2021 11:35
WordPress SOWB: Prevent Icomoon Font from Being Loaded
add_filter( 'the_content', function( $content ) {
wp_dequeue_style( 'siteorigin-widget-icon-font-icomoon' );
return $content;
} );
@AlexGStapleton
AlexGStapleton / gist:b8244ff5d49fb14e99c8110e444868a0
Created April 29, 2021 16:33
SiteOrigin Hero: Ken Burns Animation (values are examples)
.so-hero-kenburns .sow-slider-image.cycle-slide-active {
animation: 60s kenburns linear infinite alternate;
}
@keyframes kenburns{
0% {
background-size: 75%;
background-position: right 25%;
}
25% {
@AlexGStapleton
AlexGStapleton / gist:29d9dd9527d9c1b44213487606c38f1b
Created February 10, 2021 11:55
WordPress SiteOrigin Settings: Enable Page Settings for The Events Calendar event post type
add_action( 'init', function() {
add_post_type_support( 'tribe_events', 'so-page-settings' );
} );