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 December 5, 2017 20:08
Limit Excerpt
function limit_excerpt($length){
return 5;
}
add_filter('excerpt_length', 'limit_excerpt', 999);
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created November 30, 2017 01:59
Make Categories "term-select"
/** Place any new code below this line */
add_filter( 'submit_job_form_fields', 'custom_submit_job_form_fields' );
function custom_submit_job_form_fields( $fields ) {
// Here we target one of the job fields and change it to Single-select
$fields['job']['job_category']['type'] = "term-select";
// And return the modified fields
@FernandoSalinas33
FernandoSalinas33 / functions.php
Last active January 31, 2018 14:58
Display Categories on Listing Card
/**
* Add Category List To Listing Data.
*/
add_filter( 'listify_get_listing_to_array', function( $data, $listing ) {
// Default value for categories.
$categories = array();
// Get post terms for listing categories.
$terms = get_the_terms( $listing->get_object(), 'job_listing_category' );
// Check if term exists.
if ( $terms && ! is_wp_error( $terms ) ) {
function custom_listify_single_job_listing_actions_after() {
global $post;
echo '<a href="' . $post->METAKEYGoesHere . '" class="button">' . $post->METAKEYGoesHere . '</a>';
}
add_filter( 'listify_single_job_listing_actions_after', 'custom_listify_single_job_listing_actions_after' );
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created October 31, 2017 14:51
Make Experience field Optional
// Add your own function to filter the fields
add_filter( 'submit_resume_form_fields', 'custom_submit_resume_form_fields' );
// This is your function which takes the fields, modifies them, and returns them
function custom_submit_resume_form_fields( $fields ) {
// Here we target Candidate Experience and make it Optional.
$fields['resume_fields']['candidate_experience']['required'] = false;
// And return the modified fields
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created October 30, 2017 13:52
Make the Location field Required.
add_filter( 'submit_job_form_fields', 'custom_submit_job_form_fields' );
function custom_submit_job_form_fields( $fields ) {
$fields['job']['job_location']['required'] = true;
// And return the modified fields
return $fields;
}
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created October 25, 2017 18:59
Display Share Options at the bottom of Listing Description Widget
function output() {
global $post;
if ( ! function_exists( 'sharing_display' ) ) {
return;
}
$buttons = sharing_display( '' );
if ( '' == $buttons ) {
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created October 17, 2017 21:51
Change the default star rating to 5
//change the return value to the default number of stars you wish to display.
function editDefaultRating(){return 5;}
add_filter( 'listify_ratings_default_rating', 'editDefaultRating', 10, 3);
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created October 16, 2017 22:26
Add Contact Button to Description
function custom_listify_single_job_listing_actions_after() {
echo '<a href="#job_listing-author-apply" data-mfp-src=".job_application" class="popup-trigger button">' . __( 'Contact', 'listify' ) . '</a>';
}
add_filter( 'listify_widget_job_listing_content_after', 'custom_listify_single_job_listing_actions_after' );
@FernandoSalinas33
FernandoSalinas33 / functions.php
Created October 10, 2017 15:56
Hide Featured Images
// Add your own function to filter the fields
add_filter( 'submit_job_form_fields', 'remove_listify_submit_job_form_fields', 9999 );
// This is your function which takes the fields, modifies them, and returns them
function remove_listify_submit_job_form_fields( $fields ) {
if( ! isset( $fields['job'] ) ) {
return $fields;
}
// If listing fields fields exist in Job array, remove them
if( isset( $fields['job']['featured_image'] ) ) {