Skip to content

Instantly share code, notes, and snippets.

View quasel's full-sized avatar
🙃
Don't worry be happy!

Bernhard quasel

🙃
Don't worry be happy!
View GitHub Profile
@badabingbreda
badabingbreda / jquery.bbpaneloptions.js
Last active June 30, 2018 20:10
Jquery Plugin to extend the Beaver Builder Editor Sidepanel and Topbar
/*! BeaverBuilder Add Panel Option for jQuery v1.00
* http://www.badabing.nl/jquery-plugins/beaverbuilder-paneloptions/
* Do not remove any of this notice (you're welcome to use this code in commercial projects)
* Copyright (c) 2016 Didou Schol www.badabing.nl
* Licensed under the MIT license */
( function ( $ ) {
$.extend ({
bbAddPanel: function ( options ) {
// DEFAULT OPTIONS
@jamesgol
jamesgol / gist:abbf8ee1428236deccd080fadadc9fca
Last active September 14, 2017 13:30
Adding virtual Field Grouping to Pods
<?php
/*
* Add virtual Field Grouping to Pods
* This requires the PR from https://github.com/pods-framework/pods/pull/3548 which will hopefully be
* available in Pods 2.6.6
* James Golovich <james@gnuinter.net>
*/
<?php
/*
* Note! This is no longer updated here in the Gist. It has been moved to a repo.
*
* @link https://github.com/daggerhart/wp-custom-menu-items
*/
/**
* Class custom_menu_items
@SGudbrandsson
SGudbrandsson / index.php
Last active June 10, 2023 01:11
Create a WordPress staging area from your live wordpress setup with a Click-of-a-button [TM] ..
<?php
/**
*
* This script will copy your wordpress from public_html (or wherever)
* and place it in a staging folder.
* It will then clone the database, reconfigure the config file
* and replace URL's from the original URL to your staging URL.
* It will then make sure to NOT allow search engines to index the page.
*
* Use this script to clone your main wp in order to test maintenance work
@TimBHowe
TimBHowe / woocommerce-variation-grid-add-cart.php
Last active September 27, 2021 18:24
Include this in your theme to allow WooCommerce variable products to be displayed in a grid format with each variation having there own quantity and add to cart button, rather then the drop-down options. This should be include in your themes function file.
<?php
/**
* Woocommerce Custom Variation Output
*
* The following function allow for the theme to display product variations in a grid format.
* This code could be moved to a plugin but is in the theme function file as it used the
* themes grid system.
*
* @package WooGrid
* @since WooGrid 1.2
@mcaskill
mcaskill / Function.Array-Group-By.php
Last active January 3, 2024 10:15
PHP : Groups an array by a given key
<?php
if (!function_exists('array_group_by')) {
/**
* Groups an array by a given key.
*
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
*
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function.
* This variant allows $key to be closures.
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@Shelob9
Shelob9 / orderby-custom-field.php
Created March 14, 2015 19:38
Order a post type archive by a custom field
<?php
add_action( 'pre_get_posts', function ( $query ) {
if ( $query->is_main_query() && !is_admin() && $query->is_post_type_archive( 'name_of_post_type') ) {
$query->set('orderby', 'meta_value_num');
$query->set('meta_key', 'custom_field_name');
$query->set('order', 'ASC');
}
}
@LinzardMac
LinzardMac / gist:b6263de18e0d25ce4527
Created February 25, 2015 22:16
Pods Framework widget that gets a list of pods with or without a "featured" checkbox
class Custom_Widget_Pods_Testimonials extends WP_Widget {
public function __construct() {
$widget_ops = array('classname' => 'widget_pods_testimonials', 'description' => __( "Featured Testimonials.") );
parent::__construct('pods_testimonials', __('Featured Testimonials'), $widget_ops);
$this->alt_option_name = 'widget_pods_testimonials';
add_action( 'save_post', array($this, 'flush_widget_cache') );
add_action( 'deleted_post', array($this, 'flush_widget_cache') );
add_action( 'switch_theme', array($this, 'flush_widget_cache') );
}
@sergejmueller
sergejmueller / nginx.conf
Last active August 18, 2022 08:44
Stop search engines from indexing .txt, .log, .xml, .css and .js files in Nginx
location ~* \.(txt|log|xml|css|js)$ {
add_header X-Robots-Tag noindex;
}