Admin/Floating Toolbar

/** * Create a secondary admin toolbar in the top right with integrated plugin/users search * * @author mccannex * * Changelog * 2024-08-01 – Fixed issue with crashing admin backend because WP core changed priority on certain hooks *…Continue reading

Add Custom Element to Breadcrumbs

add_filter( ‘aioseo_breadcrumbs_trail’, function( $crumbs ) { if(is_singular(‘post’) || is_category()){ $blog = [ ‘label’ => ‘Resources’, ‘link’ => ‘https://whatisnosy.com/resources’, ‘type’ => ” ]; array_splice( $crumbs, 0, 0, [$blog] ); } return $crumbs; }, 10, 2);Continue reading

FXBot – Add language code to external link

function append_language_to_external_links($content) { // Get the current language of your blog $current_language = apply_filters( ‘wpml_current_language’, NULL ); if ($current_language == “en”){ $current_language = “”; } // Create a DOMDocument instance to parse the content $dom = new DOMDocument(); libxml_use_internal_errors(true); //…Continue reading

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