Skip to content

Instantly share code, notes, and snippets.

@danjjohnson
danjjohnson / courses
Created February 13, 2014 11:08
Sensei: Change 'New Courses' to 'Available Courses'
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('New Courses', 'Available Courses', $translated);
return $translated;
}
@danjjohnson
danjjohnson / superstore-product-limit.php
Last active August 29, 2015 14:01
Change the number of recent products displayed on Superstore homepage
<?php
add_action( 'admin_head', 'woo_custom_options', 50 );
function woo_custom_options(){
$limit = array();
//set the limit to 40
for ( $i = 1; $i <= 40; $i++ ) {
$limit[$i] = $i;
}
@danjjohnson
danjjohnson / gist:46a07c0f703ccfe3c465
Last active August 29, 2015 14:03
Sensei - Rename "New Courses" to "Recent Courses"
add_filter( 'sensei_new_courses_text', 'sensei_custom_new_courses_text', 10 );
function sensei_custom_new_courses_text () {
$text = "Recent Courses";
return $text;
}
@danjjohnson
danjjohnson / course-slug
Created July 11, 2014 13:43
Sensei - Change "course" slug to "workshop"
add_filter( 'sensei_course_slug', 'sensei_custom_course_slug', 10 );
function sensei_custom_course_slug () {
$slug = "workshop";
return $slug;
}
@danjjohnson
danjjohnson / amk.php
Created July 25, 2014 12:59
Sensei custom code for AMK Pro Case Study
/**
* Remove checkout field
*
* @filter woocommerce_checkout_fields
* @since 1.0.0
*
*/
function apk_override_checkout_fields( $fields ) {
@danjjohnson
danjjohnson / course-category-order
Created August 12, 2014 07:10
Change order of course catgories
function change_course_taxonomy_order( $query ) {
// Are we querying a course-category archive?
if ( is_tax( 'course-category' ) && $query->is_main_query() ) {
$query->set( 'posts_per_page', '6' );
$query->set( 'orderby', 'title' );
$query->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', 'change_course_taxonomy_order' );
@danjjohnson
danjjohnson / functions.php
Created August 26, 2014 15:44
Sensei - Change Course Category Archive title
add_filter( 'course_category_archive_title', 'custom_course_category_title', 10 );
function custom_course_category_title( $title ) {
global $wp_query;
$taxonomy_obj = $wp_query->get_queried_object();
$title = sprintf( __( 'Course Category: %s', 'woothemes-sensei' ), $taxonomy_obj->name );
$title = '<header class="archive-header"><h1>' . $title . '</h1></header>';
return $title;
}
@danjjohnson
danjjohnson / functions.php
Created September 16, 2014 14:10
Declare Sensei support in a theme
add_action( 'after_setup_theme', 'declare_sensei_support' );
function declare_sensei_support() {
add_theme_support( 'sensei' );
}
@danjjohnson
danjjohnson / functions.php
Created November 9, 2014 01:03
Remove Sensei_message from Appply title
function woo_display_top_section() {
global $woo_options, $post;
$title = '';
if ( is_category() ) {
$title = __('Archive', 'woothemes') . ' | ' . single_cat_title( '', false );
} elseif ( is_day() ) {
$title = __('Archive', 'woothemes') . ' | ' . get_the_time( get_option( 'date_format' ) );
@danjjohnson
danjjohnson / wrapper-start.php
Created November 27, 2014 13:44
Sensei wrapper files for Twenty Ten
// IF Twenty Ten
case 'twentyten' :
echo '<div id="container"><div id="content" role="main">';
break;