View tribe_get_events_with_ongoing_events.php
<?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', | |
] ); |
View stars-block.js
( 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', { |
View tribe_remove_archive_ical_links.php
<?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' ) ); | |
} | |
} |
View tribe_remove_single_calendar_links.php
<?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' ) ); | |
} | |
} |
View WP-custom_rest_api.php
// 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' ); |
View WP-custom_cron.php
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' ); | |
} |
View WP-custom_embed_header.php
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' ); |
View WP-reverse_srcset_order.php
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); |