Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mrpaulphan on github.
  • I am mrpaulphan (https://keybase.io/mrpaulphan) on keybase.
  • I have a public key ASDPKWH09Bq9OyLBRRS_83M2X2vwHcCET7Xpn55jasE01wo

To claim this, I am signing this object:

@mrpaulphan
mrpaulphan / functions.php
Last active July 27, 2017 16:40
Remove Wordpress Comments
// Add to existing function.php file
// Disable support for comments and trackbacks in post types
function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ($post_types as $post_type) {
if(post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
@mrpaulphan
mrpaulphan / gist:fd519887e974c9fb000d59113b08cdfc
Last active March 10, 2017 15:37
Reverse Query Relationship for Advanced Custom Fields
<?php
$posts = get_posts(array(
'posts_per_page' => 1,
'orderby' => 'rand',
'post_type' => 'testimonial',
'meta_query' => array(
array(
'key' => 'related_project', // name of custom field
'value' => '"' . get_the_ID() . '"',
'compare' => 'LIKE'
/**
* @author Paul Phan <phan@happycog.com>
* @description This file allows you to quickly show/hide elements by adding
* attributes to the trigger element and target element.
* @example <a href="#" data-toggle-trigger="showDropdown">click me</a>
* // Apply on the click trigger
* @example <div data-toggle-target="showDropdown">..</div>
* // Toggles element.
* @version 1.0
*/
// $large only
@include media('>=large', '<mlarge') {
[spacing*="large(1)"] > * + * {
margin-top: $spacingDesktop;
}
}
// $xsmall to $large
@include media('>=xsmall', '<large') {
[spacing-top*="xsmall-large(1)"] {
margin-top: $spacingMobile;
<div class="article article--full" spacing="1 small-medium(.5) large(3)">
<h2>{{ title }}</h2>
<p>{{ date }}| {{ category }} | {{ author }}</p>
<p>{{ body }}</p>
<ul class="tag tag-meta" spacing=".5 large(1)">...</ul>
</div>
// Variables
$spacingDesktop: 20px;
$spacingMobile: 14px;
// Default
[spacing^="1"] > * + * {
margin-top: $spacingMobile;
@include media('>large') {
margin-top: $spacingDesktop;
<div class="article article--full" spacing="1 small-medium(.5) large(3)">
<h2>{{ title }}</h2>
<p>{{ date }}| {{ category }} | {{ author }}</p>
<p>{{ body }}</p>
<ul class="tag tag-meta" spacing=".5 large(1)">...</ul>
</div>
<article class="article article--full spacing spacing-half--s-to-m spacing-half--m spacing-triple--l border-top">
<h2>{{ title }}</h2>
<p>{{ date }}| {{ category }} | {{ author }}</p>
<p>{{ body }}</p>
<ul class="tag spacing-half spacing--l">...</ul>
</article>