Skip to content

Instantly share code, notes, and snippets.

View coreymcollins's full-sized avatar

Corey M Collins coreymcollins

View GitHub Profile
@coreymcollins
coreymcollins / gutenberg-embeds.html
Created October 25, 2019 19:19
Using every embed from Gutenberg
<!-- wp:core-embed/youtube {"url":"https://www.youtube.com/watch?v=2WGr69m-RB8","type":"video","providerNameSlug":"youtube","className":"wp-embed-aspect-16-9 wp-has-aspect-ratio"} -->
<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
https://www.youtube.com/watch?v=2WGr69m-RB8
</div></figure>
<!-- /wp:core-embed/youtube -->
<!-- wp:core-embed/wordpress {"url":"https://support.wistia.com/medias/h1z3uqsjal","type":"wp-embed","providerNameSlug":"wistia-inc","className":""} -->
<figure class="wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-wistia-inc"><div class="wp-block-embed__wrapper">
https://support.wistia.com/medias/h1z3uqsjal
</div></figure>
@coreymcollins
coreymcollins / archive-page-title.php
Last active January 9, 2019 17:37
Reusable Snippets Post
<?php
function _s_remove_archive_title_prefix( $title ) {
// Get the single category title with no prefix.
$single_cat_title = single_term_title( '', false );
if ( is_category() || is_tag() || is_tax() ) {
return esc_html( $single_cat_title );
}
<?php
/**
* The template used for displaying a CTA block.
*
* @package _s
*/
// Set up fields.
$title = get_sub_field( 'title' );
$text = get_sub_field( 'text' );
@coreymcollins
coreymcollins / vscode-jquery.json
Created October 10, 2018 20:07
VS Code JS/jQuery Snippetes
"WDS jQuery Block": {
"prefix": "jq",
"body": [
"/**",
" * ${1:Name File} Script.",
" */",
"window.WDS${2:Name Object}Object = {};",
"( function( window, \\$, app ) {",
"",
" // Constructor.",
@coreymcollins
coreymcollins / vscode-element-comment.json
Created October 10, 2018 20:05
VS Code Sass/CSS Snippets
"Section Comment": {
"prefix": "element comment",
"body": [
"//-----------------------------------------",
"// ${1:partial section comment}",
"//-----------------------------------------",
"$0"
],
"description": "Partial Section Comment Block"
}
@coreymcollins
coreymcollins / vscode-die.json
Last active October 10, 2018 20:01
VS Code Snippets
"wp_die": {
"prefix": "die",
"body": [
"wp_die( '<pre>'. htmlentities( print_r( ${1:foo}, true ) ) .'</pre>' );",
],
"description": "invoke wp_die()"
},
@coreymcollins
coreymcollins / attributes.js
Last active April 9, 2018 18:01
WDS Background Options Blog Post Examples
/**
* Set the attributes to be displayed in the Background Options panel.
* @type {Object}
*/
const BackgroundOptionsAttributes = {
    backgroundType: {
        type: 'string',
    },
    backgroundImage: {
@coreymcollins
coreymcollins / index.js
Created March 30, 2018 20:26
WDS Blocks Default Block
/**
* BLOCK: Default Block
*
* This block was meant to be duplicated.
* It serves as the starting point for new blocks. 😀
*/
/**
* External dependencies
*/
@coreymcollins
coreymcollins / block.js
Last active April 8, 2019 12:11
WDS Blocks Background Options
/**
* BLOCK: Default Block
*
* This block was meant to be duplicated.
* It serves as the starting point for new blocks. 😀
*/
/**
* External dependencies
*/
@coreymcollins
coreymcollins / remove-version-numbers.php
Created February 13, 2018 03:19
Remove version numbers from WordPress core enqueues
function cmc_remove_wp_core_version_numbers( $src ) {
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'cmc_remove_wp_core_version_numbers', 9999 );
add_filter( 'script_loader_src', 'cmc_remove_wp_core_version_numbers', 9999 );