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
*/
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
<!-- 0) Display Medium sized image floated right -->
http://sridharkatakam.com/how-to-display-featured-image-in-single-posts-in-genesis/
$image_args = array(
'size' => 'medium',
'attr' => array(
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@hansschuijff
hansschuijff / disable-plugins-when-doing-local-dev.php
Created December 10, 2019 21:53 — forked from markjaquith/disable-plugins-when-doing-local-dev.php
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/