Server IP : 162.213.251.208 / Your IP : 52.14.135.68 Web Server : LiteSpeed System : Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : jmoroovq ( 1890) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/jmoroovq/expressmedicalbillingservices.com/wp-content/plugins/uicore-framework/includes/elementor/generic/ |
Upload File : |
<?php namespace UiCore\Elementor\Generic; use Elementor\Control_Select2; defined('ABSPATH') || exit(); class Query extends Control_Select2 { const CONTROL_ID = 'query'; public function get_type() { return self::CONTROL_ID; } public static function get_query_args($control_id, $settings) { $defaults = [ $control_id . '_post_type' => 'post', $control_id . '_posts_ids' => [], 'orderby' => 'date', 'order' => 'desc', 'posts_per_page' => 3, 'offset' => 0, ]; $settings = wp_parse_args($settings, $defaults); $post_type = $settings[$control_id . '_post_type']; if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } $query_args = [ 'orderby' => $settings['orderby'], 'order' => $settings['order'], 'ignore_sticky_posts' => 0, 'post_status' => 'publish', // Hide drafts/private posts for admins 'paged' => $paged, ]; $query_args['post_type'] = $post_type; $query_args['posts_per_page'] = $settings['posts_per_page']; $query_args['tax_query'] = []; $taxonomies = get_object_taxonomies($post_type, 'objects'); foreach ($taxonomies as $object) { $setting_key = $control_id . '_' . $object->name . '_ids'; if (!empty($settings[$setting_key])) { $query_args['tax_query'][] = [ 'taxonomy' => $object->name, 'field' => 'term_id', 'terms' => $settings[$setting_key], ]; } } return $query_args; } } \Elementor\Plugin::$instance->controls_manager->register_control('query', new Query());