Skip to content

Instantly share code, notes, and snippets.

@softcircles
softcircles / replace-premium-link.js
Last active April 10, 2018 10:47
Replace "Premium" Package name with a PDF link in Mylisting WordPress theme
@softcircles
softcircles / replace-listing-link.js
Created April 10, 2018 14:21
Replace listing type with custom link
@softcircles
softcircles / sort-listing-by-type.php
Created April 12, 2018 23:44
Sort Listing by Type in My Listing Wordpress Theme
add_filter( 'manage_job_listing_posts_columns', 'set_custom_edit_job_listing_columns' );
function set_custom_edit_job_listing_columns( $columns ) {
$columns['_case27_listing_type'] = esc_html__('Type', 'my-listing');
return $columns;
}
add_action( 'manage_job_listing_posts_custom_column' , 'custom_job_listing_column', 10, 2 );
@softcircles
softcircles / location-field.php
Created April 13, 2018 13:01
disable location update on edit listing form
<?php
$listing_id = ! empty( $_REQUEST[ 'job_id' ] ) ? absint( $_REQUEST[ 'job_id' ] ) : 0;
$latitude = $longitude = $lock_pin = false;
if ($listing_id) {
$latitude = get_post_meta($listing_id, 'geolocation_lat', true);
$longitude = get_post_meta($listing_id, 'geolocation_long', true);
$lock_pin = get_post_meta($listing_id, 'job_location__lock_pin', true);
// dump($latitude, $longitude, $lock_pin);
}
@softcircles
softcircles / search-form.php
Created April 17, 2018 10:14
Multiple header search form issue
<div class="<?php echo esc_attr( 'text-' . $data['align'] ) ?> <?php echo esc_attr( $data['tabs_mode'] == 'dark' ? 'featured-light' : $data['tabs_mode'] ) ?>">
<div class="featured-search reveal <?php echo esc_attr( $data['layout'] ) ?>">
<div class="fs-tabs">
<?php $tab_group_id = uniqid(); ?>
<ul class="nav nav-tabs" role="tablist">
<?php
$i = 0;
foreach ($listing_types as $type): $i++; ?>
<li role="presentation" class="<?php echo $i === 1 ? 'active' : '' ?>">
<a href="#<?php echo esc_attr( "{$tab_group_id}--{$i}" ) ?>" role="tab" class="tab-switch">
@softcircles
softcircles / listing-package-selection.php
Created April 23, 2018 12:01
move package block on top of chart on mobile device
<?php
/**
* Package Selection Step.
*
* @since 1.0.0
*
* @var array $packages Product list. Each item is CASE27\Integrations\Paid_Listings\Product object.
* @var int $packages_count Packages `$packages` count.
* @var array $user_packages User package list. Each item is CASE27\Integrations\Paid_Listings\Package object.
* @var mixed $type Listing Type object. false|CASE27\Integrations\ListingTypes\ListingType.
global $post;
$listing_id = $post->ID;
// listing name
get_post_meta( $listing_id, '_job_title', true );
// listing description
get_post_meta( $listing_id, '_job_description', true );
add_filter('wp_get_object_terms_args', function ( $args, $object_ids, $taxonomies ) {
if ( ! in_array( 'job_listing_category', $taxonomies ) || ! is_singular( 'job_listing' ) || ! isset( $args['orderby'] ) || 'term_order' != $args['orderby'] ) {
return $args;
}
$args['orderby'] = 'name';
return $args;
add_filter( 'gettext', 'listing_expire_string_translation', 20, 3 );
function listing_expire_string_translation( $translated_text, $original_text, $domain ) {
if ( 'Listing Expires' != $original_text || 'wp-job-manager' != $domain ) {
return $translated_text;
}
return 'your_custom_text'; // you may replace your string here 'your_custom_text'.
}
@softcircles
softcircles / functions.php
Created May 21, 2018 22:46
Yoast SEO description
add_filter( 'mylisting\listing\share\description', function( $description, $object ) {
$_yoast_job_description = get_post_meta( get_the_ID(), '_yoast_wpseo_metadesc', true );
if ( ! empty( $_yoast_job_description ) ) {
$description = $_yoast_job_description;
}
return $description;