Skip to content

Instantly share code, notes, and snippets.

View hansschuijff's full-sized avatar

Hans Schuijff hansschuijff

View GitHub Profile
@hansschuijff
hansschuijff / add-wordpress-settings-page.php
Created December 4, 2023 21:40 — forked from DavidWells/add-wordpress-settings-page.php
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
@hansschuijff
hansschuijff / plugin.php
Created December 4, 2023 21:29 — forked from kovshenin/plugin.php
Settings API Demo
<?php
/**
* Plugin Name: My Plugin
* Plugin Description: Settings API Demo
*/
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
add_options_page( 'My Plugin', 'My Plugin', 'manage_options', 'my-plugin', 'my_options_page' );
}
@hansschuijff
hansschuijff / functions.php
Created October 22, 2021 11:50 — forked from maddisondesigns/functions.php
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
<?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 October 21, 2021 12:02 — forked from grimzy/git-pull-all
Git pull all remote branches
#!/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 September 6, 2021 20:31 — 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.
<?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 April 1, 2024 05:03 — forked from squarestar/install-wp-plugins.php
Programmatically install and activate wordpress plugins
<?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 December 13, 2020 20:53
An alternative for remove_filter() that can remove all types of hooked callables.
<?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 November 29, 2020 22:57
Adds Module taxonomy colum to lessons list and adds it to quick edit
<?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 November 11, 2020 13:54
Force the display_logo setting of all Mollie Payment methods to "no"
<?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+