Skip to content

Instantly share code, notes, and snippets.

🤓
Available for contract work.

JR Tashjian jrtashjian

View GitHub Profile
View .browserlistrc
> 1%
ie >= 11
last 1 Android versions
last 1 ChromeAndroid versions
last 2 Chrome versions
last 2 Firefox versions
last 2 Safari versions
last 2 iOS versions
last 2 Edge versions
last 2 Opera versions
View gwg-creating-a-block-category.php
<?php
/**
* Add a block category for "Get With Gutenberg" if it doesn't exist already.
*
* @param array $categories Array of block categories.
*
* @return array
*/
function gwg_block_categories( $categories ) {
$category_slugs = wp_list_pluck( $categories, 'slug' );
@jrtashjian
jrtashjian / 01.php
Last active Apr 11, 2019
Get With Gutenberg - How to Internationalize Your Block • https://getwithgutenberg.com/2019/04/how-to-internationalize-your-block/
View 01.php
<?php
function gwg_register_block_type() {
if ( ! function_exists( 'register_block_type' ) ) {
// Gutenberg is not active.
return;
}
wp_register_style(
'gwg-style',
View readme.txt
=== CurateWP ===
Contributors: jrtashjian
Tags: curatewp, curation, block, widget, shortcode,
Requires at least: 4.9.8
Tested up to: 5.1
Requires PHP: 5.2.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@jrtashjian
jrtashjian / functions.php
Created Jan 16, 2019
Filter: curatewp_template_dir
View functions.php
<?php
add_filter( 'curatewp_template_dir', function( $template_dir ) {
// Change the template directory in your Parent or Child theme.
return 'curation_templates';
} );
@jrtashjian
jrtashjian / functions.php
Created Jan 16, 2019
Filter: curatewp_section_layout_args
View functions.php
<?php
add_filter( 'curatewp_section_layout_args', function( $layout_args, $section ) {
// Change all section featured posts layout to the "Hero".
$layout_args['layout-featured-posts'] = 'hero';
return $layout_args;
}, 10, 2 );
@jrtashjian
jrtashjian / functions.php
Last active Jan 16, 2019
Filter: curatewp_section_objects_cache_time
View functions.php
<?php
add_filter( 'curatewp_section_objects_cache_time', function() {
// Change the cache time to hourly.
return HOUR_IN_SECONDS;
} );
@jrtashjian
jrtashjian / functions.php
Created Jan 16, 2019
Filter: curatewp_section_posts
View functions.php
<?php
add_filter( 'curatewp_section_posts', function( $curated_posts, $section ) {
// Filter out a post with the ID of 25.
return array_filter( $curated_posts, function( $post_id ) {
return 25 !== $post_id;
} );
}, 10, 2 );
@jrtashjian
jrtashjian / functions.php
Last active Jan 16, 2019
Filter: curatewp_section_object_query_args
View functions.php
<?php
add_filter( 'curatewp_section_object_query_args', function( $query_args, $section ) {
// Alter the query args for a specific section.
if ( 'your-section-name' === $section->post_name ) {
$query_args[ 'category__no_in' ] = [ 2, 54 ];
}
// Pass back the altered query arguments.
@jrtashjian
jrtashjian / functions.php
Last active Jan 16, 2019
Filter: curatewp_section_cache_time
View functions.php
<?php
add_filter( 'curatewp_section_cache_time', function() {
// Change the cache time to hourly.
return HOUR_IN_SECONDS;
} );
You can’t perform that action at this time.