Event Helpers

do_action( ‘qm/debug’, ‘[EventHelpers] Registering’ ); function current_events_filter($data) { // Get current time in GMT $now = new \DateTime(‘now’); $now->setTime(0, 0); $filtered = array_filter($data, function($element) use ($now) { if(isset($element->post_date)) { $post_date = new \DateTime($element->post_date); $post_date->setTime(0, 0); if($post_date >= $now) { return…Continue reading

Studio Helpers

do_action( ‘qm/debug’, ‘[StudioHelpers] Registering’ ); function corrugated_studios_query($query) { $query->set(‘meta_query’, array( array( ‘key’ => ‘visible’, ‘value’ => 1, ‘compare’ => ‘=’ ) )); $query->set(‘post_type’, ‘corrugated-studio’); $query->set(‘order’, ‘ASC’); $query->set(‘orderby’, ‘title’); } add_action(‘elementor/query/queryCorrugatedStudios’, ‘corrugated_studios_query’); do_action( ‘qm/debug’, ‘[StudioHelpers] Registered’ );Continue reading

Allow SVG Files Upload (copy) (copy)

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading

Allow SVG Files Upload (copy)

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading

Add Multiple Checkboxes To Donation Form

/** * Add a collection of checkboxes to the donation form. * * This snippet only works in Charitable 1.5 or above. * */ function wpchar_charitable_register_new_checkboxes_field() { if ( ! class_exists(“Charitable_Donation_Field” ) ) { return; }; /** * Define a…Continue reading

Exclude All Posts of a Category from News Sitemap

add_filter( ‘aioseo_sitemap_exclude_posts’, ‘aioseo_sitemap_filter_excluded_posts’, 10, 2 ); function aioseo_sitemap_filter_excluded_posts( $ids, $type ) { if ( ‘news’ === $type ) { $category_id = 136; $posts_in_category = get_posts(array( ‘category’ => $category_id, ‘numberposts’ => -1, ‘fields’ => ‘ids’ )); $ids = array_merge($ids, $posts_in_category); }…Continue reading

Get Team ID

function team_current_group_id() {     $current_group    = groups_get_current_group();     $current_group_id = isset( $current_group->id ) ? (int) $current_group->id : 0;       /**      * Filters the ID of the current group.      *      * @since BuddyPress 1.5.0      *      * @param int    $current_group_id ID of the current…Continue reading