Skip to content

Instantly share code, notes, and snippets.

View pdewouters's full-sized avatar
🌄
Working from home

Paul de Wouters pdewouters

🌄
Working from home
View GitHub Profile
@norcross
norcross / gist-shortcode.php
Last active December 12, 2015 08:08
embed Gist shortcode
<?php
// usage: get the gist ID and place the shortcode in the site: [gist id="THE_ID"]
// allows for an optional title to display above, i.e [gist id="THE_ID" title="Some Title"]
// embed gists
function gist_shortcode($atts, $content = NULL) {
extract( shortcode_atts( array(
'id' => '',
'user' => 'norcross',
'title' => ''
@eduardozulian
eduardozulian / wp-customize-image-reloaded.php
Last active November 16, 2023 02:50
Extend WP_Customize_Image_Control class allowing access to files uploaded within the same context.
<?php
/**
* Customize Image Reloaded Class
*
* Extend WP_Customize_Image_Control allowing access to uploads made within
* the same context
*/
class My_Customize_Image_Reloaded_Control extends WP_Customize_Image_Control {
/**
* Constructor.
@trepmal
trepmal / faster-archive-links.php
Created January 26, 2013 22:16
Makes it easy to add custom post type archive links to a custom menu

Contract Killer 3

Revised date: 07/11/2012

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

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@tommcfarlin
tommcfarlin / meta-data-serialization.php
Last active November 4, 2022 00:28
An example function used to demonstrate how meta data is typically saved in a WordPress theme or plugin. The gist is made public so that developers can contribute to the standard security boilerplate functionality in order to simplify, reduce, and improve our serialization functions.
<?php
/**
* An example function used to demonstrate how to use the `user_can_save` function
* that provides boilerplate security checks when saving custom post meta data.
*
* The ultimate goal is provide a simple helper function to be used in themes and
* plugins without the need to use a set of complex conditionals and constants.
*
* Instead, the aim is to have a simplified function that's easy to read and that uses
* WordPress APIs.
@sshtmc
sshtmc / ubuntu-configure-sendmail-with-gmail
Created October 25, 2012 12:24
Ubuntu sendmail using smtp.gmail.com
#!/bin/bash
HOST=$(hostname)
function install_postfix() {
echo | sudo debconf-set-selections <<__EOF
postfix postfix/root_address string
postfix postfix/rfc1035_violation boolean false
postfix postfix/mydomain_warning boolean
postfix postfix/mynetworks string 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
//get the review type based on page custom meta field
function oswc_get_review_meta($postid) {
//try every reasonble conceivable variation that the user my enter to make this as user friendly as possible
$postTypeName = get_post_meta($postid, "Review Type", $single = true);
if(empty($postTypeName)){
$postTypeName = get_post_meta($postid, "review type", $single = true);
if(empty($postTypeName)){
$postTypeName = get_post_meta($postid, "reviewtype", $single = true);
if(empty($postTypeName)){
$postTypeName = get_post_meta($postid, "Reviewtype", $single = true);
@norcross
norcross / gist-shortcode-css.css
Created October 1, 2012 15:38
embed gist shortcode
/* Optional CSS for themes that don't wrap the pre tag properly */
div.github-gist-block pre {
background-color: #F5F5F5;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px 4px 4px 4px;
display: block;
font-size: 13px;
line-height: 20px;
margin: 0 0 10px;
padding: 9.5px;
<?php
/**
*
* ----------------------------------------------
* HTML to JSON
* ----------------------------------------------
*
* [Currently used in Wordpress to output HTML into a Google Maps InfoWindow correctly]
*
@mirisuzanne
mirisuzanne / one-mixin.scss
Created September 13, 2012 18:36
THE MOST POWERFUL SASS MIXIN EVAR.
// Apply any css property/value pair.
@mixin css(
$azimuth: null,
$background: null,
$background-attachment: null,
$background-color: null,
$background-image: null,
$background-position: null,
$background-repeat: null,
$border: null,