Skip to content

Instantly share code, notes, and snippets.

View deckerweb's full-sized avatar
🏠
Working from home

David Decker deckerweb

🏠
Working from home
View GitHub Profile
@nickcernis
nickcernis / add-editor-layout-classes.js
Last active February 20, 2020 09:09
Add Genesis layout class to Gutenberg editor pages (admin)
// Add genesis layout classes to the Block Editor.
// File lives in the theme's /js/ folder.
wp.domReady(function () {
yourTheme.updateLayoutClass();
var layouts = document.querySelector(".genesis-layout-selector");
if( layouts ) {
layouts.addEventListener("input", function (e) {
yourTheme.updateLayoutClass();
<?php
add_filter( 'jet-engine/listings/allowed-callbacks', 'jet_add_attachment_callback', 10, 2 );
function jet_add_attachment_callback( $callbacks ) {
$callbacks['jet_get_attachment_file'] = 'Get attachment file by ID';
return $callbacks;
}
function jet_get_attachment_file( $attachment_id ) {
add_action( 'template_redirect','tu_add_elementor_filter', 999 );
function tu_add_elementor_filter() {
if ( in_array( 'elementor-page elementor-page-' . get_the_ID(), get_body_class() ) ) {
add_filter( 'body_class', 'tu_add_elementor_classes' );
add_filter( 'generate_show_title','__return_false' );
}
}
function tu_add_elementor_classes( $classes ) {
$classes[] = 'full-width-content';
@csalzano
csalzano / elementor-form-additional-webhook.php
Last active March 27, 2024 15:26
Elementor Form additional webhook example
<?php
/**
* Plugin Name: Elementor Form Additional Webhook
* Plugin URI: https://gist.github.com/csalzano/dfd754e0fe8b6ac10731fad8f257c0bf
* Description: Adds a second Webhook to an Elementor form
* Version: 1.0.1
* Author: Corey Salzano
* Author URI: https://breakfastco.xyz/
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@deckerweb
deckerweb / astra-disable-google-fonts.php
Last active January 4, 2022 04:19
Astra Theme - disable Google Fonts
<?php
/** Do NOT include the opening php tag */
/**
* Do not load a list of Google Fonts in Astra
*
* @link https://gist.github.com/deckerweb/528e9f64f09b15ed4d6729b77d87dc78
* @author David Decker - DECKERWEB
*/
@christophherr
christophherr / change-custom-logo-schema-markup.php
Last active February 15, 2019 11:07
Change custom_logo Schema markup
/**
* Use one of the filters. Not multiple...
* I'd use the third.
*/
add_filter( 'wp_get_attachment_image_attributes', function ( $attr ) {
if ( isset( $attr['class'] ) && 'custom-logo' === $attr['class'] ) {
$attr['itemprop'] = 'image';
}
@deckerweb
deckerweb / astra-remove-category-sidebar.php
Last active March 10, 2023 11:22
Conditionally remove sidebar from category archives for Astra Theme
<?php
/** Do NOT include the opening php tag */
add_filter( 'astra_page_layout', 'ddw_astra_conditionally_remove_category_sidebar' );
/**
* Conditionally remove sidebar in Astra
*
* @see https://codex.wordpress.org/Conditional_Tags
* @link https://gist.github.com/deckerweb/18a141ee5a7a32f056c1f720cd0a1d28
@gschoppe
gschoppe / admin-bar-for-weglot.php
Last active October 12, 2018 10:28
Adds a "Translate" button to the admin bar, on post-edit and front end pages, that links directly to the WeGlot visual editor for that page.
<?php if(!defined('ABSPATH')) { die(); }
/*
Plugin Name: Admin Bar for WeGlot
Plugin URI: https://gschoppe.com
Description: Adds an admin bar link to translate any page on your site
Version: 0.1.0
Author: Greg Schoppe
Author URI: https://gschoppe.com
Text Domain: weglotadminbar
@danmaby
danmaby / functions.php
Last active March 30, 2018 16:44
Remove "Archives:" from WP Astra Advanced Header Add-on
<?php
// Filter out "archive" from archive page title
function wpldn_remove_archive_text( $value, $original_value, $params ) {
$value = str_replace( $params->'Archives: ', ' ', $value );
return $value;
}
add_filter( 'ast-advanced-headers-title', 'wpldn_remove_archive_text', 10, 3 );
@kimcoleman
kimcoleman / elementor_compatibility_for_pmpro.php
Last active October 26, 2023 08:40
Ensure Paid Memberships Pro compatibility when using the Elementor Page Builder.
<?php
/**
* Ensure Paid Memberships Pro compatibility when using the Elementor Page Builder:
* https://wordpress.org/plugins/elementor/
*
* Your administrator-level account must have a Membership Level in order to edit all of the pages assigned
* under Memberships > Pages.
*
* You must also set a Custom Field on the Membership Checkout page with the key 'pmpro_default_level' and
* value of a level ID in order to properly edit your Membership Checkout page using Elementor.