This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>MC TEST</title> | |
</head> | |
<body> | |
<?php | |
define('CLIENT_ID', ''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function generate_awesome_excerpt( $id, $character_limit, $ending ) { | |
if( gettype($character_limit) != 'integer' ) { | |
$character_limit = 100; | |
} | |
$post = get_post($id); | |
$content = $post->post_content; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BUCKET_NAME=${1-''} | |
# Get upload folder path using WP-CLI | |
# We use --url=http://blah.com in our WP-CLI commands so that we don't get the PHP warning about HTTP_HOSTS | |
UPLOADS_PATH=$(wp eval '$upload_dir = wp_upload_dir(); echo $upload_dir["basedir"];' --url=http://blah.com 2>&1) | |
if [[ $UPLOADS_PATH =~ Error ]] | |
then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_post_meta_object( $id ) { | |
$object = new stdClass(); | |
$meta = get_post_meta( $id ); | |
foreach( $meta as $key => $value ) { | |
$object->{$key} = $value[0]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function superConsoleLog( arg ) { | |
console.time( arg ); | |
console.profile( arg ); | |
console.assert( arg ); | |
console.count( arg ); | |
console.debug( arg ); | |
console.dir( arg ); | |
console.dirxml( arg ); | |
console.error( arg ); | |
console.info( arg ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* | |
* Get posts with a standard query | |
* Include all the meta data in the result | |
* | |
*/ | |
function get_posts_with_meta( $args ) { | |
$query = get_posts($args); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calculate scroll position in all IE9+ Firefox, Chrome, and Edge | |
var scrollTop = 0; | |
window.addEventListener('scroll', function(e){ | |
scrollTop = document.documentElement.scrollTop || window.scrollY; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://developer.wordpress.org/reference/functions/wp_enqueue_script/ | |
function add_my_scripts( ) { | |
wp_enqueue_script( 'my-script-identifier', get_template_directory_uri() . '/js/my-script.js', 1.0, true ); | |
} | |
add_action('wp_enqueue_scripts', 'add_my_scripts'); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE pm | |
FROM wp_postmeta pm | |
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id | |
WHERE wp.ID IS NULL | |
SELECT * | |
FROM wp_postmeta pm | |
LEFT JOIN wp_posts wp ON wp.ID = pm.post_ID | |
WHERE wp.post_type = 'review' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.equalize = function( ){ | |
var tallest = 0; | |
jQuery(this).each(function(){ | |
if( jQuery(this).height() > tallest ){ | |
tallest = jQuery(this).height(); | |
} | |
}); | |
if( jQuery(window).width() > 992 ){ | |
jQuery(this).css('height',tallest + 'px'); | |
} else { |