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
@tashcan
tashcan / battle.js
Created January 8, 2024 01:28
STFC Battle Journal Parse code
import fs from "fs";
const battleJson = JSON.parse(fs.readFileSync("battle.json"));
let readingAbilitiesApply = false;
let readingFTs = false;
let readingAttack = false;
let idx = 0;
@felixarntz
felixarntz / wp-plugin-mu-loader.php
Last active October 10, 2022 12:21
WP Plugin MU Loader
<?php
/**
* Plugin initialization file
*
* @package WP_Plugin_MU_Loader
* @since 1.0.0
*
* @wordpress-plugin
* Plugin Name: WP Plugin MU Loader
* Plugin URI: https://gist.github.com/felixarntz/daff4006112b60dfea677ca08fc0b31c
@carlosonweb
carlosonweb / bb-loop-query-args.php
Last active February 14, 2020 18:57
Beaver Builder Filter Hook: fl_builder_loop_query_args To Filter by Meta Keys
/**
* Add this to the child theme's functions.php file.
*/
add_filter( 'fl_builder_loop_query_args', function( $query_args ){
$today = date( 'd.m.Y', time() );
// Past ( today > start_date )
if ( 'PAST_POST_MODULE_ID_HERE' == $query_args[ 'settings' ]->id ) {
$query_args[ 'meta_query' ] = array(
'key' => 'end_date',
/* 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) {
@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 {
@djrmom
djrmom / custom-hooks.php
Created August 24, 2017 14:51
facetwp add view all radio button
<?php
/** adds a "View All" index value to every post
** change 'my_radio' to the name of the radio facet to apply to
** 'View All' can be changed to whatever label is preferred
** reindex after add this code
**/
add_filter( 'facetwp_indexer_row_data', function( $rows, $params ) {
if ( 'my_radio' == $params['facet']['name'] ) {
$new_row = $params['defaults'];
@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
*
@gemmadlou
gemmadlou / remove-visual-composer-shortcodes.md
Last active April 20, 2024 14:56
Removing Visual Composer & Shortcodes From Wordpress Content

Adding @k1sul1's suggestion from the comments as it's more concise than what I had before:

I just wanted them all gone, so I ran this in the MySQL shell.

UPDATE wp_posts SET post_content = REGEXP_REPLACE(post_content, "\\[\/?vc(.*?)\]", "");

Note the double backslash. If you forget it, you'll replace all v's and c's with nothing, and the shortcodes will still be there. This works for other shortcode as well, just replace vc.

@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
@justintadlock
justintadlock / font-awesome.php
Last active September 28, 2021 11:09
PHP array of Font Awesome icons.
<?php
// Font Awesome v. 4.6.
function jt_get_font_icons() {
return array(
'fa-glass' => 'f000',
'fa-music' => 'f001',
'fa-search' => 'f002',
'fa-envelope-o' => 'f003',