Skip to content

Instantly share code, notes, and snippets.

View FernandoSalinas33's full-sized avatar

Fernando Salinas FernandoSalinas33

View GitHub Profile
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created April 20, 2018 14:27
Change the Home Logo link
if ( ! function_exists( 'listify_partial_site_branding' ) ) {
/**
* Site branding.
*
* @since 1.7.0
*
* @return string
*/
function listify_partial_site_branding() {
$custom_logo = get_theme_mod( 'custom_logo', null );
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created April 18, 2018 14:00
Add a List of Labels to Listing Card
/**
* Attach custom data to the listing object.
*
* This does not output anything, it only passes the information to the Javascript template.
*/
add_filter( 'listify_get_listing_to_array', function( $data, $listing ) {
// Get our custom value (this is the labels from the WP_Post object). Update accordingly.
$labels = get_the_term_list( $listing->get_object()->ID, 'job_listing_tag', '', ', ', '' );
// Only add if our custom field is not empty.
@FernandoSalinas33
FernandoSalinas33 / gist:4ffa6c722a2501a59fb113ffea4e846d
Created April 10, 2018 14:29
limit autocomplete to UK locations
add_filter( 'listify_map_settings', function( $args ) {
$args['mapService']['googlemaps']['autoCompleteArgs']['componentRestrictions'] = array(
'country' => ["uk"]
);
return $args;
} );
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created April 2, 2018 14:38
Add Company Website to Single Listing Actions
function custom_listify_single_job_listing_actions_after() {
global $post;
$url = get_post_meta( $post->ID, '_company_website', true );
echo '<a href="' . esc_url( $url ) . '" class="button">My Button</a>';
}
add_filter( 'listify_single_job_listing_actions_after', 'custom_listify_single_job_listing_actions_after' );
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created March 12, 2018 16:15
Hide additional Social accounts
function custom_user_contact_methods( $user_contact ) {
unset( $user_contact[ 'pintrest' ] );
unset( $user_contact[ 'github' ] );
unset( $user_contact[ 'googleplus' ] );
unset( $user_contact[ 'linkedin' ] );
return $user_contact;
}
add_filter( 'user_contactmethods', 'custom_user_contact_methods', 20 );
@FernandoSalinas33
FernandoSalinas33 / gist:3bceed40edeaa24e61da8f921e742d24
Created February 2, 2018 00:07
hide Claim Widget if Listing is claimed
add_action( 'single_job_listing_start' , 'hide_claim_widget', 150, 3 );
function hide_claim_widget( ) {
$claimed = get_post_meta( get_post()->ID, '_claimed', true );
if ( 1 == $claimed ) {
echo '<style>.widget_listing_sidebar_claim_listing{display:none;}</style>';
}
}
@FernandoSalinas33
FernandoSalinas33 / gist:0063f5e9b1450ece92e96b6de7cd3a3e
Created January 22, 2018 21:23
Hide Listify Cart Icon for 'Guests'
function hide_cart( $items){
if (!is_user_logged_in()){
$items = ' ';
}
return $items;
}
add_filter( 'listify_cart_icon_logged_in_only', 'hide_cart');
function trim_excerpt($text) {
$string = "....";
$text = $text . $string;
return $text;
}
add_filter('get_the_excerpt', 'trim_excerpt', 99);
<?php
return array(
'post_type' => 'job_listing',
'orderby' => array( 'menu_order' => 'ASC', 'date' => 'DESC' ),
'order' => 'asc',
'post_status' => 'publish'
);
function custom_address_formats( $formats ) {
$formats[ 'DK' ] = "{address_1} {street_number} \n{address_2}\n{postcode} {city} {state}\n{country}";
return $formats;
}
add_filter( 'listify_address_formats', 'custom_address_formats', 20 );