Skip to content

Instantly share code, notes, and snippets.

View qstudio's full-sized avatar

Ray qstudio

View GitHub Profile
@qstudio
qstudio / add-post-slug-and-post_type-to-page-body-classes.php
Last active August 29, 2015 13:56
WP - add post slug and post_type to page body classes
<?php
// add filter to body_class
add_filter( 'body_class', 'q_body_class', 1 );
/*
* add extra classes to html body tag
*/
function q_body_class( $classes ) {
@qstudio
qstudio / get_post_by_meta.php
Last active April 4, 2024 11:24
WordPress / Get Post by Meta Value
<?php
/**
* Get Post object by post_meta query
*
* @use $post = get_post_by_meta( array( meta_key = 'page_name', 'meta_value = 'contact' ) )
* @since 1.0.4
* @return Object WP post object
*/
function get_post_by_meta( $args = array() )
@qstudio
qstudio / pll_copy_post_metas.php
Last active September 15, 2021 16:36
WP / PolyLang / Un-Sync Specified Custom Fields
<?php
// filter to exclude specified post_meta from Polylang Sync ##
add_filter( 'pll_copy_post_metas', 'q_pll_copy_post_metas' );
/**
* Remove defined custom fields from Polylang Sync
*
* @since 0.1
* @param Array $metas
public static function delete_signup( $key ) {
// get signup from $key ##
$signup = GFSignup::get( $key );
// return error, if nothing found ##
if( is_wp_error( $signup ) ) {
return $signup;
@qstudio
qstudio / force-ssl-url-scheme.php
Last active January 7, 2016 10:05 — forked from cliffordp/force-ssl-url-scheme.php
Get SSL / HTTPS to work properly on WP Engine type hosts.Jason Cohen, Aug 28 05:29 pm (CDT):This is because the SSL processing is done at the front-end caching layer and not at the back-end PHP layer. By the time the request gets back there, the protocol is HTTP again rather than HTTPS.However, WordPress also defines a PHP variable saying whethe…
<?php
/*
Plugin Name: Force SSL URL Scheme
Plugin URI: https://gist.github.com/cliffordp/6378826
Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work. Recommended to me by Jason Cohen of WP Engine on 2013-08-28.
Version: 1.0.1
Author: WebAware
Author URI: http://www.webaware.com.au/
*/
// Gravity Forms Post Render ##
$( document ).bind( 'gform_post_render', function(){
// notify ##
//console.log("GF Rendered");
// look for li.limit_date ##
if ( $("li.limit_date").length ) {
// default mindate and maxdate values ##
@qstudio
qstudio / query_google_wp_remote_post.php
Last active January 26, 2016 20:29
Query Google using wp_remote_post() function
<?php
/**
* Run a Google query
*
* @since 0.1
* @return void
*/
public static function google_query( $query = null ){
<?php
namespace q\test;
class url {
// results ##
public static
$results = [
'url' => 'MISSING',
@qstudio
qstudio / Gruntfile.js
Last active May 24, 2020 12:59 — forked from zimaben/Gruntfile.js
Q SASS Taskrunner Guide
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
// ------- configuration ------- ##
// common SCSS root for easier SCSS @use / @forward / @incuse usage ##
includePaths: [
'./library/theme/scss/' // common SCSS root ##
@qstudio
qstudio / hello-willow-class-ui.php
Last active December 13, 2020 16:46
Hello Willow Example
class ui {
function hello( $args = null ) {
// define key + value to render ##
return [
'hello' => 'Hello'
];
}