Skip to content

Instantly share code, notes, and snippets.

@esedic
esedic / functions.php
Created October 23, 2023 15:29 — forked from BruceMcKinnon/functions.php
Gravity Forms - Button to delete file uploads for an entry
add_filter( 'gform_entry_detail_meta_boxes', 'add_delete_attachment_meta_box', 10, 3 );
function add_delete_attachment_meta_box( $meta_boxes, $entry, $form ) {
$my_form_id = 3;
if ( $form['id'] == $my_form_id ) {
if ( ! isset( $meta_boxes['payment'] ) ) {
$meta_boxes['payment'] = array(
'title' => esc_html__( 'Delete Attachments', 'gravityforms' ),
@esedic
esedic / webstoemp-gulpfile.js
Created March 9, 2023 14:37 — forked from jeromecoupe/webstoemp-gulpfile.js
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@esedic
esedic / Mark parent navigation active when on custom post type single page Mark (highlight) custom post type parent as active item in Wordpress Navigation.When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Get post ID, if nothing found set to NULL
$id = ( isset( $post->ID ) ? get_the_ID() : NULL );
@esedic
esedic / import-optimizations.md
Created October 26, 2022 14:38 — forked from trey8611/import-optimizations.md
WP All Import - Optimize your import speed.
@esedic
esedic / rsformprocleanup.php
Created September 23, 2022 09:21 — forked from renekreijveld/rsformprocleanup.php
RSForm!Pro cleanup old submissions
<?php
/**
* @package RSFormCleanUp
* @copyright Copyright 2018 René Kreijveld, DSD Business Internet.
* @license GNU General Public License version 2 or later.
*/
/**
* A command line cron job to remove submission data from RSFormPro database tables.
* Based on the excellent work of Peter Martin, db8.nl, see https://gist.github.com/pe7er/47bf1020b12ef29df8603fa80d1fdccd
@esedic
esedic / functions.php
Created March 17, 2022 13:40 — forked from corsonr/functions.php
WooCommerce: disable payments on checkout page
<?php // Do not include this if already open! Code goes in theme functions.php.
// Disable all payment gateways on the checkout page and replace the "Pay" button by "Place order"
add_filter( 'woocommerce_cart_needs_payment', '__return_false' );
<?php
/**
* @version 1.0.0
* @package Readmedia
* @copyright Copyright (C) 2018 David Jardin - djumla GmbH
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://www.djumla.de
* Add this to .htaccess:
* RewriteRule ^images\/downloads\/.*$ readmedia.php [L]
@esedic
esedic / j4xall.php
Created October 27, 2021 14:38 — forked from alexandreelise/README.md
Render All Joomla! 4 Standard Form Fields
<?php
declare(strict_types=1);
/**
* Render All Joomla! 4 Standard Form Fields
*
* @version 1.0.0
* @package all
* @author Alexandre ELISÉ <contact@alexapi.cloud>
* @copyright (c) 2009-2021 . Alexandre ELISÉ . Tous droits réservés.
* @license GPL-2.0-and-later GNU General Public License v2.0 or later
@esedic
esedic / htmlhelper-select-options-with-empty-default.php
Created September 19, 2021 17:51 — forked from alexandreelise/htmlhelper-select-options-with-empty-default.php
Code snippet for HTMLHelper select options with empty default value
<label for="demo">Demo</label>
<select id="demo" name="demo">
<?php array_unshift($this->myExampleOptionsArray, null); ?>
<?php echo HTMLHelper::_('select.options', $this->myExampleOptionsArray, 'value', 'text', $this->selectedOptionValue ?? '');?>
</select>
@esedic
esedic / add-custom-fields-to-core-modules-j3x.php
Created September 19, 2021 17:49 — forked from alexandreelise/add-custom-fields-to-core-modules-j3x.php
Add custom fields to core modules in Joomla! 3
<?php
defined('_JEXEC') or die;
?>
<div class="latestnews">
<ul class="list-group list-group-flush">
<?php foreach ($list as $item) : $image = json_decode($item->images); ?>
<?php
// most important part
// context:
// for articles: com_content.article