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
@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') );
}
@jamesgol
jamesgol / CPT-Admin-Fields.php
Created October 25, 2016 21:45
Pods CPT Admin Fields
<?php
/**
* Name: CPT Admin Fields
*
* Description: Allow adding fields to the CPT editor table.
*
* Version: 2.3
*
* Category: Advanced
*
@lukecav
lukecav / add-to-cart.php
Created July 31, 2016 02:57
Display Product Variations in the Shop Loop
<?php
/**
* Loop Add to Cart
*
* This template can be overridden by copying it to yourtheme/woocommerce/loop/add-to-cart.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@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>
*/
@Pross
Pross / cachehelper.php
Last active October 18, 2017 18:25
Please use this repo: https://github.com/Pross/beaver-cache-helper This gist will not be updated anymore.
<?php
/**
* Plugin Name: Beaver Builder Cache Helper
* Description: This plugin will clear various caches when layouts and templates are saved. It also clears the cache when WordPress finishes updating plugins and themes. The plugin also defines the DONOTCACHEPAGE constant when the builder is active, this is respected by most cache plugins.
* Version: 1.0
* License: GNU General Public License v2.0
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
class FL_Cache_Buster {
@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');
}
}
/* Move the wp-admin bar to the bottom */
#wpadminbar {
bottom: 0;
position: fixed;
top: initial;
}
body.logged-in.admin-bar {
margin-top: -32px;
}
@media(max-width:782px) {
@sc0ttkclark
sc0ttkclark / gist:8768847
Created February 2, 2014 13:59
pods_api_post_save_pod_item_{pod} hook example
<?php
/**
* Filter the Pods saving process and run actions / modify values
*
* @param array $pieces An array of different variables you can *change*, see below
*
* List of $pieces variables includes:
*
* array $pieces['fields'] An array of fields on the Pod, 'value' key stores the *new* value if it's been set to save
*
@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
@Rarst
Rarst / GPLv2.php
Last active April 20, 2019 08:08
WordPress File Templates for PhpStorm.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.