Skip to content

Instantly share code, notes, and snippets.

add_filter( 'sensei_question_show_answers', '__return_true' );
@danjjohnson
danjjohnson / gist:549c40711c4ec074692222e0a2f182c9
Created May 11, 2017 07:18
Sensei Enfold theme integration - May 2017
global $woothemes_sensei;
global $avia_config;
remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 );
remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 );
add_action('sensei_before_main_content', 'my_theme_wrapper_start', 10);
add_action('sensei_after_main_content', 'my_theme_wrapper_end', 10);
function my_theme_wrapper_start() {
@danjjohnson
danjjohnson / gist:2ea180c1644a7b98ee62d9841dfca122
Created April 28, 2017 07:29
WPJM: add bookmark button to a new hook
global $job_manager_bookmarks;
add_action( 'job_application_end', array( $job_manager_bookmarks, 'bookmark_form' ) );
@danjjohnson
danjjohnson / gist:491cd9195c7ada7b0ce82e65bf0eeba7
Last active November 18, 2016 16:48
Change the date format on Sensei certificates
From v1.0.5 of certificates, if you use {{completion date}} in your certificate template, it will automatically use the correct language for the month name, based on the language you set in your wp-config.php file
However, depending on your language, you may want to rearrange the date format to display the elements in a different order.
By default the date is formatted as follows:
English:
jS F Y
@danjjohnson
danjjohnson / gist:c10282a165a7f26f76d4c4509a1dfb9a
Created November 16, 2016 17:28
Default module styles for Sensei
.module-archive #main .status,#main .course .module-status{padding:.382em 1em;-webkit-border-radius:5px;border-radius:5px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;color:#fff;font-weight:bold;background:#c6c6c6;clear:both;display:inline-block}.module-archive #main .status:before,#main .course .module-status:before{font-family:FontAwesomeSensei,FontAwesome;display:inline-block;font-size:100%;margin-right:.618em;font-weight:normal;line-height:1em;width:1em}.module-archive #main .status.completed,#main .course .module-status.completed{background:#63a95f}.module-archive #main .status.completed:before,#main .course .module-status.completed:before{content:"\f00c"}.module-archive #main .status.in-progress:before,#main .course .module-status.in-progress:before{content:"\f110"}.module-lessons .lesson-status{font-style:normal}.module-lessons .lesson-status.complete{color:#63a95f}.module-lessons .lesson-status.complete:before{font-family:FontAwesomeSensei,FontAwesome;di
@danjjohnson
danjjohnson / functions.php
Last active August 25, 2021 18:39
WPJM: Limit file upload size
<?php
function limit_upload_size_limit_for_non_admin( $limit ) {
if ( ! current_user_can( 'manage_options' ) ) {
$limit = 1000000; // 1mb in bytes
}
return $limit;
}
add_filter( 'upload_size_limit', 'limit_upload_size_limit_for_non_admin' );
@danjjohnson
danjjohnson / functions.php
Created July 29, 2016 11:51
Jetpack: Exclude related posts from multiple cats
function jetpackme_filter_exclude_category( $filters ) {
$filters[] = array( 'not' => array( 'term' => array( 'category.name.raw' => array( 'donotshow', 'events' ) ) ) );
return $filters;
}
add_filter( 'jetpack_relatedposts_filter_filters', 'jetpackme_filter_exclude_category' );
@danjjohnson
danjjohnson / functions.php
Created July 21, 2016 10:20
Jetpack: Disable carousel for specific posts only
function cl_tweak_carousel( $extra_data ) {
global $post;
$ids = array( 23,62 );
if ( in_array( $post->ID, $ids ) ) {
$extra_data = array();
}
return $extra_data;
}
add_filter( 'jp_carousel_add_data_to_container', 'cl_tweak_carousel');
@danjjohnson
danjjohnson / functions.php
Created July 19, 2016 15:37 — forked from chaselivingston/gist:2569f4f1b2435451ca99de3d898395e6
Jetpack: Disable carousel for a specific post only
function cl_tweak_carousel( $extra_data ) {
global $post;
if ( $post->ID == 23 ) {
$extra_data = array();
}
return $extra_data;
}
add_filter( 'jp_carousel_add_data_to_container', 'cl_tweak_carousel');
@danjjohnson
danjjohnson / functions.php
Created July 5, 2016 07:30
WPJM - change job slug to name-location
add_filter( 'submit_job_form_save_job_data', 'custom_submit_job_form_save_job_data', 10, 5 );
function custom_submit_job_form_save_job_data( $data, $post_title, $post_content, $status, $values ) {
$job_slug = array();
$job_slug[] = $post_title;
// Append location
if ( ! empty( $values['job']['job_location'] ) )