Skip to content

Instantly share code, notes, and snippets.

View davoraltman's full-sized avatar

Davor Altman davoraltman

View GitHub Profile
@davoraltman
davoraltman / functions.php
Created July 10, 2017 10:37
Remove a field from the job submission page
add_filter( 'submit_job_form_fields', 'custom_submit_job_form_fields_dm' );
function custom_submit_job_form_fields_dm( $fields ) {
// in this example, we remove the job_tags field
unset($fields['job']['job_tags']);
// And return the modified fields
return $fields;
}
function dm_display_wpjm_categories () {
$terms = get_terms( array(
'taxonomy' => 'job_listing_category',
'hide_empty' => false,
) );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li>' . '<a href="' . esc_url( get_term_link( $term ) ) . '">' . $term->name . '</a></li>';
@davoraltman
davoraltman / redirectJD
Last active February 28, 2021 03:55
Redirect to Job Dashboard after job submission
add_filter( 'submit_job_steps', 'replace_done_with_redirect' );
function replace_done_with_redirect( $steps ) {
$steps['done'] = array(
'priority' => 30,
'handler' => function() {
if ( wp_redirect( job_manager_get_permalink( 'job_dashboard' ) ) ) {
exit;
}
}
### 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 December 9, 2019 23:47
Add author name, says:, and Gravatar image to the title of each post
<?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
Last active February 23, 2019 20:07
Add Display Job Categories Shortcode for a single listing
function dm_display_wpjm_single_categories () {
$terms = wp_get_post_terms( get_the_ID(), 'job_listing_category' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li>' . '<a href="' . esc_url( get_term_link( $term ) ) . '">' . $term->name . '</a></li>';
}
echo '</ul>';
}
}
@davoraltman
davoraltman / functions.php
Created November 16, 2018 12:27
Hide Category: from category pages
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 November 16, 2018 12:22
Remove Uncategorized posts from Jetpacks Top Posts & Pages Widget
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' )
);
@davoraltman
davoraltman / functions.php
Created July 25, 2017 17:24
Prefill the company logo field
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;
}
function disable_wpcomtoolbar ( $modules ) {
if ( isset( $modules['masterbar'] ) ) {
unset( $modules['masterbar'] );
}
return $modules;
}
add_filter( 'jetpack_get_available_modules', 'disable_wpcomtoolbar' );