Skip to content

Instantly share code, notes, and snippets.

View danfisher85's full-sized avatar
😎
Focusing

Dan Fisher danfisher85

😎
Focusing
View GitHub Profile
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@stephenharris
stephenharris / color_luminance.php
Created May 7, 2013 14:19
Lighten or darken a given colour
<?php
/**
* Lightens/darkens a given colour (hex format), returning the altered colour in hex format.7
* @param str $hex Colour as hexadecimal (with or without hash);
* @percent float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() )
* @return str Lightened/Darkend colour as hexadecimal (with hash);
*/
function color_luminance( $hex, $percent ) {
// validate hex string
@dovy
dovy / Redux-required-arg-exampes.php
Last active March 4, 2021 14:16
Example of the required attribute for the Redux Framework.
<?php
$options = array(
'required' => array('id','equals',array( 1,3 ) ) // Multiple values
);
$options = array(
'required' => array('id','equals', array( 1 ) ) // Single value
);
@rutger1140
rutger1140 / map.js
Last active July 21, 2017 17:54
Javascript module pattern to 'lazy load' Google Maps asynchronous, with jQuery
// global.js
// Global debug logger
var debug = true,
log = function(s){
if(debug) {
console.log(s);
}
};
@adamsilverstein
adamsilverstein / expanded_alowed_tags
Last active April 3, 2024 18:15
WordPress expanded allowed tags for wp_kses with iframe, forms, etc.
function expanded_alowed_tags() {
$my_allowed = wp_kses_allowed_html( 'post' );
// iframe
$my_allowed['iframe'] = array(
'src' => array(),
'height' => array(),
'width' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),
);
@mikejolley
mikejolley / gist:4b495f544bb632757e27
Last active May 12, 2022 12:14
Resume Manager Repeated Rows Example. Requires 1.11.4
/**
* Return an array of fields which will repeat (have multiple rows)
*
* Subfields should be named group_fieldname[]
*
* @return array
*/
function get_custom_repeated_field_fields() {
return array(
'field1' => array(
<?php
/*
Register Fonts
*/
function studio_fonts_url() {
$font_url = '';
/*
Translators: If there are characters in your language that are not supported
by chosen font(s), translate this to 'off'. Do not translate into your own language.
@mikejolley
mikejolley / gist:f19bdc23ef5bd4123089
Created September 16, 2015 13:15
Add a region bias to geolocation in job manager
<?php
/**
* Add to functions.php. Replace country_code with a CCTLD
*/
function wp_job_manager_region_bias() {
return 'country_code';
}
add_filter( 'job_manager_geolocation_region_cctld', 'wp_job_manager_region_bias' );
@robertknight
robertknight / wrap.html
Created October 11, 2016 12:45
Using min-width and overflow-wrap to wrap long words in flexbox layouts
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<style>
.container {
display: flex;
flex-direction: row;
max-width: 100%;
<?php
/**
* Get all type posts
*
* @return void
* @author alispx
**/
function alispx_get_type_posts_data( $post_type = 'post' ) {