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
add_filter( 'tribe_events_views_v2_view_repository_args', 'set_default_listview_date', 10, 2 ); | |
/** | |
* Sets TEC list view date to '30 days ago' when the view is 'now'. | |
* | |
* @param array $args The default context args from the filter. | |
* @param array $context the default TEC context. | |
*/ | |
function set_default_listview_date( $args, $context ) { | |
if ( 'now' === $args['ends_after'] ) { | |
$args['ends_after'] = '30 days ago'; |
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 | |
add_filter( 'wp_unique_post_slug', 'cpt_unique_slug_by_tax', 10, 6 ); | |
function cpt_unique_slug_by_tax( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) { | |
if ( 'guide' === $post_type ) { | |
global $wpdb; | |
$post_tax = get_the_terms( $post_ID, 'guide_cat' ); | |
// Check if another CPT exists in the same taxonomy with the same name. |
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
/** | |
* Add dependency to a preregistered script. Returns false if script hasnt been registered. | |
* | |
* @param string $handle | |
* @param string $dependency | |
* @return bool | |
*/ | |
function jl_add_script_dependency( $handle, $dependency ) { | |
global $wp_scripts; |