Skip to content

Instantly share code, notes, and snippets.

@kraftbj
kraftbj / functions.php
Created August 30, 2016 20:24
Set the language of geocoded results
<?php //remove in an existing file
add_filter( 'job_manager_geolocation_endpoint', 'bk_set_geocode_lang' );
function bk_set_geocode_lang( $endpont ){
$endpoint = add_query_arg( 'language', 'de', $endpoint );
return $endpoint;
}
@kraftbj
kraftbj / functions.php
Created August 8, 2016 17:16
Change from one image to any image, Pinterest, Jetpack
<?php // remove in an existing file
add_filter( 'jetpack_sharing_pinterest_widget_type', 'bk_jetpack_pinterest_widget' );
function bk_jetpack_pinterest_widget( $widget ){
return 'buttonBookmark';
}
@kraftbj
kraftbj / functions.php
Created August 5, 2016 21:15
Add a Jetpack Google API key until 4.2 comes out
<?php // remove in an existing file
add_filter( 'jetpack_google_maps_api_key', 'bk_add_key' );
function bk_add_key( $key ){
return 'ADD IN YOUR KEY HERE';
}
@kraftbj
kraftbj / functions.php
Last active August 3, 2016 18:48
Force all Photon images to highest quality
<?php // do not include this line.
add_filter( 'jetpack_photon_pre_args', 'bk_always_high_quality' );
function bk_always_high_quality( $args ){
$args['quality'] = 100;
return $args;
}
@kraftbj
kraftbj / functions.php
Created July 25, 2016 20:00
Change bookmark URL
<?php //remove in an existing file
add_filter( 'job_manager_bookmark_form_login_url', 'set_custom_login_for_bookmarks_only');
function set_custom_login_for_bookmarks_only( $url ){
return 'http://your-custom-link-goes-here.com';
}
@kraftbj
kraftbj / functions.php
Last active July 20, 2016 20:50
Remove the Polylang WPJM workaround
<?php //remove in an existing file
add_filter( 'get_job_listings_query_args', 'bk_remove_polylang', 10, 2 );
function bk_remove_polylang( $query_args, $args ){
if ( is_array( $query_args ) && isset( $query_args['lang'] ) ) {
unset( $query_args['lang'] );
}
return $query_args;
}
@kraftbj
kraftbj / functions.php
Last active June 1, 2016 15:34
wp_link_pages within the content
<?php //remove in an existing file
add_filter( 'the_content', 'content_page_links', 18 ); // 18 would put it just before Jetpack's sharing links at priority 19.
function content_page_links( $content ){
$content .= wp_link_pages( array (
'echo' => false,
));
return $content;
}
@kraftbj
kraftbj / functions.php
Created May 30, 2016 20:46
Change the from address
<?php // remove from an existing file
add_filter( 'wp_mail_from', 'bk_change_from' );
function bk_change_from( $from ){
return 'wordpress@domain.com';
}
@kraftbj
kraftbj / functions.php
Last active May 24, 2016 21:44
More control over OG images
<?php // remove in existing file
add_filter( 'jetpack_open_graph_tags', 'bk_custom_og_image_logic');
function bk_custom_og_image_logic( $tags ){
$image_width = absint( apply_filters( 'jetpack_open_graph_image_width' , 200 ) );
$image_height = absint( apply_filters( 'jetpack_open_graph_image_height', 200 ) );
$args = array(
'from_thumbnail' => true, // Use these flags to specify which methods to use to find an image
@kraftbj
kraftbj / functions.php
Created May 13, 2016 19:08
Restrict cats and tags based on something
add_filter( 'job_manager_output_jobs_defaults', 'bk_example_default_filter', 11 ); // needs to be 11 to catch the Tags
function bk_example_default_filter( $atts ){
$atts['show_tags'] = false;
$atts['show_categories'] = false;
if (INSERT CONDITIONAL HERE TO DETERMINE THE ROLE/USER/ETC YOU WANT ) {
$atts['show_tags'] = true;
$atts['show_categories'] = true;
}