Skip to content

Instantly share code, notes, and snippets.

View tripflex's full-sized avatar
🦋
in the zone

Myles tripflex

🦋
in the zone
View GitHub Profile
@tripflex
tripflex / functions.php
Created January 4, 2024 22:21
Only output Remote label without Google Map Link when remote position and using WP Job Manager Field Editor
<?php
add_filter( 'the_job_location_map_link', 'smyles_disable_output_remote_location_link', 9999, 3 );
function smyles_disable_output_remote_locations( $link, $location, $post ){
if( $post->_remote_position ){
return apply_filters( 'the_job_location_anywhere_text', __( 'Remote', 'wp-job-manager' ) );
}
return $link;
@tripflex
tripflex / functions.php
Created December 27, 2023 21:00
Field editor format output using comma instead of period, and vice versa
<?php
add_filter('field_editor_get_custom_field_listing_meta', 'format_job_price_for_germany', 10, 4);
function format_job_price_for_germany($field_value, $field_slug, $listing_id, $args) {
// Check if the field slug is 'job_price'
if ($field_slug == 'job_price') {
// Ensure the field value is not empty and is a numeric value
if (!empty($field_value) && is_numeric($field_value)) {
// Format the number to German standards: comma for decimal and period for thousands
@tripflex
tripflex / style.css
Last active November 21, 2023 21:21
Hide gray box above Job Listings when using Search and Filtering for WP Job Manager
/* This hides the gray box above job listings output */
.job_filters .search_jobs {
display: none;
}
/* This hides the "Search Completed. Found X Matching Records." and the RSS & Reset Links */
/* !important is required as javascript code unhides this element after results are returned */
.job_filters .showing_jobs {
display: none !important;
}
@tripflex
tripflex / functions.php
Created November 1, 2023 21:40
Populate Post Names for Dropdown field when using WP Job Manager Search and Filtering
<?php
function smyles_populate_post_titles( $section_data, $section_id, $section ) {
if ( ! isset( $section_data['fields'] ) || ! is_array( $section_data['fields'] ) ) {
return $section_data;
}
foreach ( $section_data['fields'] as $field_id => $field ) {
if ( $field['search_source'] == 'job_title' ) {
@tripflex
tripflex / functions.php
Created September 7, 2023 22:22
Disable CSV multi field output on WorkScout Overview Area with WP Job Manager Field Editor
<?php
add_filter( 'field_editor_workscout_overview_output_csv', '__return_false' );
@tripflex
tripflex / functions.php
Created September 2, 2023 19:55
WP Job Manager Keywords Search Disregard Order of Terms (untested)
<?php
function smyles_custom_posts_search($search, $wp_query) {
global $wpdb;
if (empty($search)) {
return $search; // skip processing - no search term in query
}
$q = $wp_query->query_vars;
@tripflex
tripflex / leaflet-clusters.css
Created May 18, 2023 19:20
Leaflet Marker Cluster Default Colors
.marker-cluster-small {
background-color: rgba(181,226,140,.6)
}
.marker-cluster-small div {
background-color: rgba(110,204,57,.6)
}
.marker-cluster-medium {
background-color: rgba(241,211,87,.6)
@tripflex
tripflex / functions.php
Created February 9, 2023 00:29
Custom Singular "Job" Value when using Search and Filtering Result Replacement
<?php
add_filter('search_and_filtering_job_singular', 'smyles_sf_job_singular');
function smyles_sf_job_singular( $singular ){
return __('job today');
}
add_filter('search_and_filtering_job_plural', 'smyles_sf_job_plural');
function smyles_sf_job_plural( $singular ){
@tripflex
tripflex / functions.php
Last active November 29, 2022 22:37
Disable showing localize() warning when WP_DEBUG is enabled
<?php
add_filter( 'doing_it_wrong_trigger_error', 'smyles_disable_localize_warning', 9999, 2 );
function smyles_disable_localize_warning( $trigger, $function ){
if( $function === 'WP_Scripts::localize' ){
return false;
}
return $trigger;
}
@tripflex
tripflex / functions.php
Created November 21, 2022 22:49
Hide child terms for specific taxonomy when using Search and Filtering (requires 1.1.29 or newer)
<?php
add_filter( 'search_and_filtering_get_taxonomy_data_options_include_child_terms', 'smyles_tax_child_terms', 10, 2 );
function smyles_tax_child_terms( $args, $taxonomy ){
if( $taxonomy === 'job_listing_category' ){
return false;
}