This file contains 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 reverse_srcset_order($atts) { | |
if (isset($atts['srcset'])) { | |
$srcset = explode(', ', $atts['srcset']); | |
$srcset_reversed = array_reverse($srcset); | |
$atts['srcset'] = join(', ', $srcset_reversed); | |
} | |
return $atts; | |
} | |
add_filter('wp_get_attachment_image_attributes','reverse_srcset_order',1,1); |
This file contains 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 goyippi_embed_header() { | |
wp_deregister_style('open-sans'); | |
wp_enqueue_style( 'goyippi-embed-font', 'http://fonts.googleapis.com/css?family=Droid+Sans:400,700','','', 'all' ); | |
wp_enqueue_style( 'goyippi-embed-styles', get_bloginfo('stylesheet_directory').'/wp-style_embed.css','','', 'all' ); | |
} | |
add_action( 'embed_head', 'goyippi_embed_header' ); |
This file contains 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 your_function(){ | |
// **** Add your function here **** | |
} | |
add_action( 'your_cron_action', 'your_function' ); | |
// Init Cron Job | |
function init_custom_cron() { | |
if( !wp_next_scheduled( 'your_cron_action' ) ){ | |
wp_schedule_event( time(), '20min', 'your_cron_action' ); | |
} |
This file contains 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
// Init REST Route | |
function register_custom_api_hooks() { | |
$namespace = 'custom-name/v1'; | |
register_rest_route( $namespace, '/posts/', array( | |
'methods' => 'GET', | |
'callback' => 'custom_api_get_posts', | |
) ); | |
} | |
add_action( 'rest_api_init', 'register_custom_api_hooks' ); |
This file contains 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 | |
/** | |
* Removes the iCal and Google cal links from the single event page | |
*/ | |
function tribe_remove_single_calendar_links() { | |
if ( function_exists( 'tribe' ) ) { | |
remove_action( 'tribe_events_single_event_after_the_content', array( tribe( 'tec.iCal' ), 'single_event_links' ) ); | |
} | |
} |
This file contains 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 | |
/** | |
* Removes the iCal and Google cal links from archive pages | |
*/ | |
function tribe_remove_calendar_export_links() { | |
if ( function_exists( 'tribe' ) ) { | |
remove_action( 'tribe_events_after_footer', array( tribe( 'tec.iCal' ), 'maybe_add_link' ) ); | |
} | |
} |
This file contains 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( blocks, element ) { | |
var el = element.createElement; | |
function Stars( { stars } ) { | |
return el( 'div', { key: 'stars' }, | |
'★'.repeat( stars ), | |
( ( stars * 2 ) % 2 ) ? '½' : '' ); | |
} | |
blocks.registerBlockType( 'stars/stars-block', { |
This file contains 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 // Retrieve all events (with ongoing events) in October 2019 | |
$events = tribe_get_events( [ | |
'eventDisplay' => 'custom', | |
'ends_after' => '2019-10-01 00:01', | |
'starts_before' => '2019-10-31 23:59', | |
] ); |
OlderNewer