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
@quasel
quasel / archive-menu-order.php
Created December 4, 2017 10:23 — forked from chrisguitarguy/archive-menu-order.php
Force orderby to `menu_order` on a custom post type archive and a few custom taxonomy archives
<?php
add_action('parse_query', 'pmg_ex_sort_posts');
/**
* Hooked into `parse_query` this changes the orderby and order arguments of
* the query, forcing the post order on post type archives for `your_custom_pt`
* and a few taxonomies to follow the menu order.
*
* @param object $q The WP_Query object. This is passed by reference, you
* don't have to return anything.
* @return null
@quasel
quasel / remove-replace-go-to-top.php
Created October 25, 2017 17:36 — forked from digisavvy/remove-replace-go-to-top.php
Remove beaver builder's 'go to top' markup and modify it with my own.
<?php
/**
* Removes markup for built-in scroll to top link
*
* Renders scroll to top button for wp_footer.
*
*/
add_action( 'wp_head', 'dgs_remove_go_to_top' );
add_action( 'wp_footer', 'dgs_remove_go_to_top' );
function dgs_remove_go_to_top(){
@quasel
quasel / disable-html-module-render.php
Created September 20, 2017 08:28 — forked from fastlinemedia/disable-html-module-render.php
Disable HTML module rendering when in the Beaver Builder UI.
add_filter( 'fl_builder_render_module_content', function( $content, $module ) {
if ( 'html' === $module->settings->type && FLBuilderModel::is_builder_active() ) {
$content = 'HTML rendering disabled in the builder.';
}
return $content;
}, 10, 2 );
@quasel
quasel / functions.php
Created September 14, 2017 21:07 — forked from Pross/functions.php
Some animations using animate.css
<?php
// The following code is designed to be added to your child theme functions.php
// It adds a new 'Animation Redux' setting under the advanced tab for any module.
add_filter( 'fl_builder_module_custom_class', 'fl_builder_module_custom_class_filter', 10, 2 );
function fl_builder_module_custom_class_filter( $class, $module ) {
$animate = '';
if ( ! empty( $module->settings->animation_redux ) ) {
$animate = ' animated ' . $module->settings->animation_redux;
wp_enqueue_style( 'animate-css', '//cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css' );
@quasel
quasel / gist:612b5169d209d2a5aee85a7e4e625090
Created September 13, 2017 14:54 — forked from jamesgol/gist:33eea04760b47c8bcd62132ac7108904
Allow WooCommerce variations to be added to cart via URL
add_action( 'init', 'woo_add_to_cart_fixup' );
function woo_add_to_cart_fixup() {
// Duplicate WooCommerce variation attributes from $_GET to $_POST because WC_Form_Handler->add_to_cart_handler_variable only looks in $_POST
if ( isset( $_GET, $_GET['add-to-cart'] ) ) {
foreach ( $_GET as $key => $value ) {
if ( false !== strpos( $key, 'attribute' ) ) {
$_POST[ $key ] = $value;
}
}
}
@quasel
quasel / 0_reuse_code.js
Created July 12, 2017 17:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@quasel
quasel / phpcs-mac-os-howto.md
Created June 10, 2017 12:00 — forked from klederson/phpcs-mac-os-howto.md
How to setup PHP CodeSniffer into PHP Storm with Mac OSX

Good Practices

PHP CodeSniffer into PHP Storm

Install PHPCS in mac

sudo cp /private/etc/php.ini.default /private/etc/php.ini;
sudo php /usr/lib/php/install-pear-nozlib.phar;
pear config-set php_ini /private/etc/php.ini;
@quasel
quasel / remove-visual-composer-shortcodes.md
Created June 5, 2017 21:46 — forked from gemmadlou/remove-visual-composer-shortcodes.md
Removing Visual Composer & Shortcodes From Wordpress Content
@quasel
quasel / woocommerce-variation-grid-add-cart.php
Created April 16, 2017 09:22 — forked from TimBHowe/woocommerce-variation-grid-add-cart.php
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
@quasel
quasel / .htaccess
Created January 24, 2017 14:01 — forked from jdevalk/.htaccess
These three files together form an affiliate link redirect script.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteRule (.*) ./index.php?id=$1 [L]
</IfModule>