Skip to content

Instantly share code, notes, and snippets.

Avatar

Davor Altman davoraltman

View GitHub Profile
View gist:308abe4e99290d648cf931e30430bbca
### Keybase proof
I hereby claim:
* I am davoraltman on github.
* I am izuvach (https://keybase.io/izuvach) on keybase.
* I have a public key ASDMB5rEgfsf6j2ICz7IqUdBOseonEiAaAlKbitL1YW7qAo
To claim this, I am signing this object:
@davoraltman
davoraltman / functions.php
Last active Dec 9, 2019
Add author name, says:, and Gravatar image to the title of each post
View functions.php
<?php
add_filter('the_title', 'daki_title');
function daki_title($dakisha_title) {
$daki_author_ime = get_the_author_meta('display_name');
$daki_author_email = get_the_author_meta('user_email');
$daki_author_slika = get_avatar_url($daki_author_email);
$dakisha_title = '<img width="16px" height="16px" src="' . $daki_author_slika . '" />' . " " . $daki_author_ime . ' says: ' . $dakisha_title;
return $dakisha_title;
}
@davoraltman
davoraltman / functions.php
Created Nov 16, 2018
Hide Category: from category pages
View functions.php
function prefix_category_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
}
return $title;
}
add_filter( 'get_the_archive_title', 'prefix_category_title' );
@davoraltman
davoraltman / functions.php
Created Nov 16, 2018
Remove Uncategorized posts from Jetpacks Top Posts & Pages Widget
View functions.php
function daki_remove_post_top_posts( $posts, $post_ids, $count ) {
foreach ( $posts as $k => $post ) {
// Get the list of categories for that post.
$categories = wp_get_post_categories(
$post['post_id'],
// We only need the category slug here.
array( 'orderby' => 'name', 'order' => 'ASC', 'fields' => 'slugs' )
);
View gist:2e26f1384b719b0669dea1195b221cfd
function disable_wpcomtoolbar ( $modules ) {
if ( isset( $modules['masterbar'] ) ) {
unset( $modules['masterbar'] );
}
return $modules;
}
add_filter( 'jetpack_get_available_modules', 'disable_wpcomtoolbar' );
@davoraltman
davoraltman / functions.php
Created Mar 27, 2018
Lossy Image Compression With Photon
View functions.php
add_filter('jetpack_photon_pre_args', 'jetpackme_custom_photon_compression' );
function jetpackme_custom_photon_compression( $args ) {
$args['quality'] = 80;
$args['strip'] = 'all';
return $args;
}
@davoraltman
davoraltman / functions.php
Created Sep 4, 2017
Enable comments on job listings
View functions.php
// Add comment support to the job listing post type - you'll need to enable the comments for old listings manually
add_filter( 'register_post_type_job_listing', 'register_post_type_job_listing_enable_comments' );
function register_post_type_job_listing_enable_comments( $post_type ) {
$post_type['supports'][] = 'comments';
return $post_type;
}
// Make comments open by default for new job listings
add_filter( 'submit_job_form_save_job_data', 'custom_submit_job_form_save_job_data' );
@davoraltman
davoraltman / functions.php
Created Jul 26, 2017
Change the candidate title
View functions.php
// Add your own function to filter the fields
add_filter( 'submit_resume_form_fields', 'custom_submit_resume_form_fields_dm' );
// This is your function which takes the fields, modifies them, and returns them
function custom_submit_resume_form_fields_dm( $fields ) {
// Here we target one of the job fields (candidate name) and change it's label
$fields['resume_fields']['candidate_title']['label'] = "My pro title";
// And return the modified fields
return $fields;
}
@davoraltman
davoraltman / functions.php
Created Jul 25, 2017
Prefill the company logo field
View functions.php
add_filter('submit_job_form_fields', 'dm_prefill_company_logo');
function dm_prefill_company_logo( $fields ) {
$fields['company']['company_logo']['value'] = 'full_url_to_the_logo';
return $fields;
}
@davoraltman
davoraltman / functions.php
Created Jul 20, 2017
Change the From email and name
View functions.php
add_filter( 'create_job_application_notification_headers','dm_job_application_headers', 10, 3 );
function dm_job_application_headers( $headers, $job_id, $application_id ) {
$candidate_name = get_the_title( $application_id );
$candidate_email = get_post_meta( $application_id, '_candidate_email', true );
$headers[] = 'From: ' . $candidate_name . ' <' . $candidate_email . '>';
return $headers;
}