Skip to content

Instantly share code, notes, and snippets.

Avatar

Hans Schuijff hansschuijff

View GitHub Profile
@hansschuijff
hansschuijff / functions.php
Created Oct 22, 2021 — forked from maddisondesigns/functions.php
WooCommerce Custom Fields for Simple & Variable Products
View functions.php
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
View Restore original Post Data.php
<?php
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
echo '</ul>';
} else {
@hansschuijff
hansschuijff / git-pull-all
Created Oct 21, 2021 — forked from grimzy/git-pull-all
Git pull all remote branches
View git-pull-all
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@hansschuijff
hansschuijff / wcs-remove-my-subscriptions-buttons.php
Created Sep 6, 2021 — forked from thenbrent/wcs-remove-my-subscriptions-buttons.php
Remove any given button from the My Subscriptions table on the My Account page. By default, only the "Change Payment Method" button is removed, but you can uncomment additional actions to remove those buttons also.
View wcs-remove-my-subscriptions-buttons.php
<?php
/**
* Plugin Name: Remove Subscription Action Buttons from My Account
* Plugin URI: https://gist.github.com/thenbrent/8851287/
* Description: Remove any given button from the <a href="http://docs.woothemes.com/document/subscriptions/customers-view/#section-2">My Subscriptions</a> table on the My Account page. By default, only the "Change Payment Method" button is removed, but you can uncomment additional actions to remove those buttons also.
* Author: Brent Shepherd
* Author URI:
* Version: 2.0
*/
@hansschuijff
hansschuijff / install-wp-plugins.php
Last active Jun 24, 2022 — forked from squarestar/install-wp-plugins.php
Programmatically install and activate wordpress plugins
View install-wp-plugins.php
<?php
/**
* Plugin Name: Activate required plugins.
* Description: Programmatically install and activate plugins based on a runtime config.
* Version: 1.0
* Author: Hans Schuijff
* Author URI: http://dewitteprins.nl
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
@hansschuijff
hansschuijff / core-functionality-custom-remove-filter.php
Created Dec 13, 2020
An alternative for remove_filter() that can remove all types of hooked callables.
View core-functionality-custom-remove-filter.php
<?php
/**
* Unhook callbacks from WordPress filter or action hooks.
* including the removal of closures and methods of anonymous objects.
*
* @package DeWittePrins\CoreFunctionality
* @author Hans Schuijff
* @since 1.0.0
* @license GPL-2.0+
**/
@hansschuijff
hansschuijff / add-course-module-to-lesson-admin.php
Created Nov 29, 2020
Adds Module taxonomy colum to lessons list and adds it to quick edit
View add-course-module-to-lesson-admin.php
<?php
/**
* Makes the module column in the admin's lesson list sortable.
*
* @package DeWittePrins\CoreFunctionality\SenseiLMS
* @since 1.7.1
* @author Hans Schuijff
* @link https://dewitteprins.nl
* @license GNU-2.0+
*/
@hansschuijff
hansschuijff / force-display-logo-setting.php
Last active Nov 11, 2020
Force the display_logo setting of all Mollie Payment methods to "no"
View force-display-logo-setting.php
<?php
/**
* Forces the display_logo setting to "no"
* on all Mollie gateways
*
* @package DeWittePrins\CoreFunctionality;
* @since 1.7.12
* @author Hans Schuijff
* @link https://dewitteprins.nl
* @license GNU-2.0+
View disable-display-logo.php
<?php
/**
* Set the display_logo option to "no" for all mollie payment options
*
* @package DeWittePrins\CoreFunctionality;
* @since 1.7.12
* @author Hans Schuijff
* @link https://dewitteprins.nl
* @license GNU-2.0+
*/
View essence-pro-title-functions-changes-for-the-event-calendar-page-titles.php
<?php
/**
* Relocates page titles and adds header image wrapper.
*
* @since 1.0.0
*/
function essence_page_hero_header() {
add_action( 'genesis_before_header', 'essence_header_hero_start' );
add_action( 'genesis_after_header', 'essence_header_title_wrap', 90 );