Changeset 3245727
- Timestamp:
- 02/24/2025 12:09:27 PM (13 months ago)
- Location:
- recruitly/trunk
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
admin/includes/shortcodes.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
-
recruitly.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
recruitly/trunk
-
Property
svn:ignore
set to
.idea
-
Property
svn:ignore
set to
-
recruitly/trunk/admin/includes/shortcodes.php
r3235770 r3245727 54 54 55 55 /** 56 * Lists all jobs with pagination support 57 */ 58 function recruitly_wordpress_job_listing_shortcode() 59 { 60 61 //recruitly_wordpress_insert_post_type(); 56 * Lists all jobs with pagination support and optional shortcode attributes. 57 */ 58 function recruitly_wordpress_job_listing_shortcode($atts) 59 { 60 // Extract shortcode attributes and set defaults 61 $atts = shortcode_atts( 62 array( 63 'job_county' => '', // Default: no county filter 64 ), 65 $atts, 66 'recruitly_jobs' 67 ); 62 68 63 69 global $wp_query; 64 65 70 $temp = $wp_query; 66 71 72 // Handle pagination 67 73 if (get_query_var('paged')) { 68 69 74 $paged = get_query_var('paged'); 70 71 75 } elseif (get_query_var('page')) { 72 73 76 $paged = get_query_var('page'); 74 75 77 } else { 76 77 78 $paged = 1; 78 79 } 80 79 } 80 81 // Base query arguments 81 82 $args = array( 82 83 'post_type' => RECRUITLY_POST_TYPE, … … 88 89 ); 89 90 90 91 // Check for search parameters and nonce validation 91 92 if (isset($_GET['recruitly_jobsearch_nonce']) 92 93 && wp_verify_nonce($_GET['recruitly_jobsearch_nonce'], 'recruitly_jobsearch_action') 93 94 && isset($_GET['job_search'])) { 94 95 95 // Escape Output96 // Escape and sanitize input 96 97 if (isset($_GET['job_type'])) $job_type = htmlspecialchars(sanitize_text_field(wp_unslash($_GET['job_type']))); 97 98 if (isset($_GET['job_sector'])) $job_sector = htmlspecialchars(sanitize_text_field(wp_unslash($_GET['job_sector']))); … … 100 101 if (isset($_GET['job_search'])) $q = htmlspecialchars(sanitize_text_field(wp_unslash($_GET['job_search']))); 101 102 103 // Add search query if provided 102 104 if ($q) { 103 105 $args['s'] = $q; 104 106 } 105 107 108 // Initialize tax_query and meta_query arrays 106 109 $args['tax_query'] = array('relation' => 'AND'); 107 //Tag is a meta query 110 $args['meta_query'] = array('relation' => 'AND'); 111 112 // Job Tag (meta query) 108 113 if ($job_tag) { 109 $args['meta_query'] = array('relation' => 'AND');110 114 $args['meta_query'][] = array( 111 'value' => $job_tag 112 ); 113 } 114 115 //Job Type, Sector and City are Taxonomy Queries 115 'key' => 'job_tag', // Assuming 'job_tag' is the meta key 116 'value' => $job_tag, 117 'compare' => '=' 118 ); 119 } 120 121 // Job Type, Sector, City (taxonomy queries) 116 122 if ($job_type) { 117 123 $args['tax_query'][] = array( … … 121 127 ); 122 128 } 123 124 129 if ($job_sector) { 125 130 $args['tax_query'][] = array( … … 129 134 ); 130 135 } 131 132 136 if ($job_city) { 133 137 $args['tax_query'][] = array( … … 137 141 ); 138 142 } 139 140 } 141 143 } 144 145 // Add job_county filter from shortcode attributes 146 if (!empty($atts['job_county'])) { 147 $args['tax_query'][] = array( 148 'taxonomy' => 'jobcounty', 149 'field' => 'slug', 150 'terms' => sanitize_text_field($atts['job_county']) // Sanitize the input 151 ); 152 } 153 154 // Execute the query 142 155 $wp_query = new WP_Query($args); 156 157 // Start output buffering 143 158 ob_start(); 144 159 get_recruitly_template('job-listing.php'); 145 160 wp_reset_query(); 146 161 $wp_query = $temp; 162 163 // Return the buffered content 147 164 return ob_get_clean(); 148 165 } -
recruitly/trunk/readme.txt
r3235770 r3245727 4 4 Requires at least: 4.5 5 5 Tested up to: 6.7.1 6 Stable tag: 2.0.2 46 Stable tag: 2.0.25 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 113 113 * Fix shortcode search filter issue. 114 114 115 = 2.0.25 = 116 * Added optional job_county filter to the [recruitly_jobs] shortcode for more flexible job listings. 117 115 118 == Upgrade Notice == 116 119 -
recruitly/trunk/recruitly.php
r3235770 r3245727 4 4 Plugin URI: https://recruitly.io 5 5 Description: Recruitly job board integration. 6 Version: 2.0.2 46 Version: 2.0.25 7 7 Author: Recruitly 8 8 Author URI: https://recruitly.io
Note: See TracChangeset
for help on using the changeset viewer.