Skip to content

Instantly share code, notes, and snippets.

Avatar

Pieter Bos senlin

View GitHub Profile
@senlin
senlin / contribution-svg.rb
Created September 26, 2018 09:32 — forked from jcouyang/contribution-svg.rb
SVG image for your github contributions calendar
View contribution-svg.rb
require "nokogiri"
require "open-uri"
url = "https://github.com/#{params['username']}"
document = Nokogiri::HTML(open(url))
contrib_boxes = document.css('svg.js-calendar-graph-svg')[0]
contrib_boxes['xmlns']="http://www.w3.org/2000/svg"
width = (params['width']||54*13-2).to_i
height = (params['height']||89).to_i
contrib_boxes.css('text').remove
contrib_boxes['width']=(width+11).to_s+'px'
@senlin
senlin / classic-editor-addon.php
Last active February 3, 2019 03:13
Classic Editor Addon by SO WP & Greg Schoppe - Classic Editor plugin doesn't remove Gutenberg by default. With this addon function we set the option that controls this from no-replace to replace, we remove the Settings link from the main Plugins page and we hide the Settings from the Settings > Writing screen. We also suppress the Nag screen tha…
View classic-editor-addon.php
<?php
/**
* Plugin Name: Classic Editor Addon
* Plugin Author: Pieter Bos (https://so-wp.com) and Greg Schoppe (https://gschoppe.com)
* Description: The Classic Editor plugin doesn't remove Gutenberg by default. With this function we set the option that controls this from no-replace to replace and we remove the Settings link from the main Plugins page
*/
function classic_editor_addon_hardcode_replace( $value ) {
return 'replace';
@senlin
senlin / controllers--contact.php
Created January 3, 2018 18:05 — forked from bastianallgeier/controllers--contact.php
Plain contactform example for Kirby 2
View controllers--contact.php
<?php
return function($site, $pages, $page) {
$alert = null;
if(get('submit')) {
$data = array(
'name' => get('name'),
@senlin
senlin / language-independent-acf-theme-options-output.php
Last active October 26, 2022 05:44
How to get language independent ACF theme options on a WPML site
View language-independent-acf-theme-options-output.php
<?php
/**
* To get this to work, you need to tinker with the acf/settings/ filter and reset the default language
* so that the get_field() function returns the correct results even when not on the default language.
*
* You can add the filter before you call the get_field() function and then call it again with the current
* language to reset it again, so it will affect other pages.
*
* answer courtesy of James of ACF Support
*/
@senlin
senlin / Three Wise Monkeys.md
Last active February 6, 2018 11:34 — forked from malarkey/Three Wise Monkeys.md
Three Wise Monkeys (NDA)
View Three Wise Monkeys.md

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?

View gw-gravity-forms-map-fields-to-field.php
<?php
/**
* Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field
*
* Preview your Gravity forms on the frontend of your website. Adds a "Live Preview" link to the Gravity Forms toolbar.
*
* Usage
*
* 1 - Enable "Allow field to be populated dynamically" option on field which should be populated.
* 2 - In the "Parameter Name" input, enter the merge tag (or merge tags) of the field whose value whould be populated into this field.
View custom_posttype_glance.php
<?php
/**
* Adding Custom post type counts in 'Right now' Dashboard widget.
* Acording this changes :
* - https://core.trac.wordpress.org/ticket/26571
* - https://core.trac.wordpress.org/ticket/26495
* now you can't use 'right_now_*' action API to show your custom post type count from your Dashboard.
* But if you running WP 3.8 or above, you can use 'dashboard_glance_items' instead.
*
* @package Wordpress
@senlin
senlin / sButton.php
Last active August 29, 2015 14:19
Issue with WordPress shortcodes When I insert '[button]Button text[/button]' into a page, automatically <br /> tags comes before and after it, but I do not want that to happen. OP: https://www.linkedin.com/groups/Issue-WordPress-shortcodes-3722491.S.5993861951699058688
View sButton.php
<?php
function sButton( $atts, $content = null ) {
extract(shortcode_atts(
array(
'link' => '#',
'grootte' => 'klein',
'id' => '1',
'randen' => ''
), $atts )
);
@senlin
senlin / wpml-config.xml
Created August 2, 2014 01:42
WPML configuration file for the TOC+ WordPress plugin. The plugin comes with 5 variables in the Settings that cannot be translated. If you are running a multilingual website with WPML just add this file to the root of the plugin and you will see the 5 strings show up in the String Translations
View wpml-config.xml
<wpml-config>
<admin-texts>
<key name="toc-options">
<key name="heading_text" />
<key name="visibility_show" />
<key name="visibility_hide" />
<key name="sitemap_pages" />
<key name="sitemap_categories" />
</key>
</admin-texts>
View gw-gravity-forms-minimum-characters.php
<?php
/**
* Gravity Wiz // Require Minimum Character Limit for Gravity Forms
*
* Adds support for requiring a minimum number of characters for text-based Gravity Form fields.
*
* @version 1.0
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/...