Skip to content

Instantly share code, notes, and snippets.

Pieter Bos senlin

Block or report user

Report or block senlin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@senlin
senlin / contribution-svg.rb
Created Sep 26, 2018 — 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 Feb 3, 2019
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 Jan 3, 2018 — 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 / single-share.php
Last active Jan 31, 2016
Single share template part used to add social media sharing links under the Single Post. See LinkedIn WordPress Group Discussion https://www.linkedin.com/groups/154024/154024-6097864780436033538
View single-share.php
<?php
/**
* Template Part to show social media sharing on Single Posts
*
* look up the different sharing links at the resp. media sites
* replace username on line 22 with your own Twitter username
* replace textdomain with slug of your theme
*
* save this file in the folder template-parts (add it if you don't have it)
* call the template part by adding the following line after the `entry-content` div on your `single.php` template:
@senlin
senlin / language-independent-acf-theme-options-output.php
Last active Sep 2, 2019
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 / so-first-image.php
Created Oct 13, 2015
grab first image of a Post if author has not added the Featured Image. If no images in the Post, then a default image will be selected. This default image is pulled from the images folder of the (child)theme. Made this snippet following this LinkedIn discussion: https://www.linkedin.com/grp/post/1482937-6059269092706177028
View so-first-image.php
<?php
/**
* Function that grabs the first image in a Post
* If there is no image, then it loads a default image
*
* @source: //wordpress.stackexchange.com/a/60267/2015
*/
// add this function to your functions.php file or to your functionality file or plugin
View has-site-icon-snippet.php
<?php
if ( ! function_exists( 'has_site_icon' ) || ! has_site_icon() ) {
// Output old, custom favicon feature.
}
@senlin
senlin / category.php
Created Aug 28, 2015
adapted category template to make a specific category temporarily unavailable (used TwentyFourteen templates). Original question via LinkedIn: https://www.linkedin.com/grp/post/154024-6042674356423839748
View category.php
<?php
/**
* The template for displaying Category pages
*
* Change the number of the category you want to make inaccessible
* on line 21
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
@senlin
senlin / index-loop.php
Created Aug 27, 2015
The while loop of the index.php that could be used to solve the issue of showing excerpts to visitors and full content to logged in users
View index-loop.php
<?php
/**
* Sample loop that can be used on index.php template to show full content to logged-in users
* and excerpts to visitors.
*
* ### IMPORTANT: ###
* ### Theme should use separate template for homepage for this to work. ###
*
* @original question: //linkedin.com/grp/post/2203862-6042328310845833217
*/
@senlin
senlin / Three Wise Monkeys.md
Last active Feb 6, 2018 — 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?

You can’t perform that action at this time.